samedi 4 mars 2017

When should a std::vector be used over a std::list?

Two STL containers, std::vector and std::list, seem to provide very similar functions. As far as I can tell, the only difference is that a std::list provides O(1) time for modification, and O(n) time for reading, and vice-versa for the vector. Are there any other differences? If I perform roughly equal of each operation, which should I use?

Aucun commentaire:

Enregistrer un commentaire