C'è un motivo std::front
e std::back
non sono presenti in C++ 11? Ci sono std::begin
e std::end
quindi per me, avere l'equivalente per quanto riguarda le istanze reali avrebbe senso.Mancanza di std :: anteriore e std :: indietro
7
A
risposta
6
std::begin()
e std::end()
si suppone di lavorare per tutti contenitori fondamentali (compresi gli array C-style).
Infatti, se il contenitore sostiene gli begin()
e end()
funzioni, std::begin()
e std::end()
inoltrare la chiamata a quelle funzioni membro.
Tuttavia, non tutti i contenitori supportano le funzioni membro front()
e back()
.
Problemi correlati
- 1. Differenze tra std :: is_integer e std :: is_integral?
- 2. C++ std :: coppia, std :: vector e memcopy
- 3. std :: make_shared, std :: unique_ptr e spostare costruttori
- 4. Differenza tra std :: set e std :: priority_queue
- 5. Scelta tra std :: map e std :: unordered_map
- 6. std :: vector :: emplace_back e std :: move
- 7. Informazioni su std :: function e std :: bind
- 8. std :: funzione e std :: packaged_task conversione
- 9. std :: forward_list e std :: :: forward_list push_back
- 10. std :: stringstream e std :: ios :: binary
- 11. Differenza tra std: string e std :: string
- 12. std :: vector e std :: comportamento min
- 13. Differenza tra std :: uninitialized_copy e std :: copy?
- 14. Differenza tra std :: logical_not e std :: not1?
- 15. std :: :: ios_base mangiava e std :: :: trunc ios_base
- 16. Esiste un motivo di progettazione per cui std :: set non ha funzioni membro anteriore e posteriore?
- 17. Differenza tra std :: vector e std :: array di inizializzazione elenca
- 18. volatile e const volatile std :: tuple e std :: get
- 19. std :: vector di std :: vettori contiguità
- 20. std :: back_inserter per std :: set?
- 21. std :: auto_ptr a std :: unique_ptr
- 22. std :: mem_fun vs std :: mem_fn
- 23. Efficienza di std :: get con std :: tupla
- 24. C++ std :: vettore di indipendente std :: threads
- 25. std :: vector più veloce di std :: unordered_set?
- 26. std :: uniform_real_distribution e rand()
- 27. MinGW e std :: thread
- 28. Eigen e std :: vector
- 29. std :: bind to std :: function?
- 30. std :: any by std :: exception_ptr
Giusto per chiarire, tutti i contenitori significano davvero tutti i contenitori, anche gli array semplici. –
@JoachimPileborg: certo. Ma sottolineerò questo, grazie. –
Anche se 'std :: stack' non supporta' begin' e 'end'. – abergmeier