I\'ve been reading up on STL containers in my book on C++, specifically the section on the STL and its containers. Now I do understand each and every one of them have their
I answered this in another question which is marked as dup of this one. But I feel that it is nice to refer to some good articles regarding the decision to choose a standard container.
As @David Thornley answered, std::vector is the way to go if there are no other special needs. This is the advice given by the creator of C++, Bjarne Stroustrup in a 2014 blog.
Here is the link for the article https://isocpp.org/blog/2014/06/stroustrup-lists
and quote from that one,
And, yes, my recommendation is to use std::vector by default.
In the comments, user @NathanOliver also provides another good blog, which has more concrete measurements. https://baptiste-wicht.com/posts/2012/12/cpp-benchmark-vector-list-deque.html .