cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Beginners
Vector vs. list sequential access
Vector vs. list sequential access
May 28, 2012 at 1:29pm UTC
Amnesiac
(53)
As lists don't support random access I know that vectors would be used instead, but for sequential access which is better and why?
May 28, 2012 at 1:37pm UTC
Athar
(4466)
vectors are better, because the elements of a vector are right next to each other in memory. This means better cache locality and avoiding playing Tarzan by jumping from node to node when traversing the list.
May 28, 2012 at 1:53pm UTC
vlad from moscow
(6539)
It is more important the question how will be inserted new elements in the container?
Topic archived. No new replies allowed.