Vectors and Linked List

What is the purpose of vectors and linked list and how do you utilize them?
vector is a safe yinamically sized array. It is basically a default container in C++: if you need sequential container to store your data, use vector, you can change it later anytime.

Basically use it every time when you would use C-array, especially when you would allocate it dynamically using new.


List are almost never used. Use them if you:
1) Need persistent iterator to the elements
2) Will do a lot of insertions in the middle and moving elements around
3) Need fast concurrent container
4) Do not need random access
ok. Sorry, but what is a container?
A Container is an object used to store other objects and taking care of the management of the memory used by the objects it contains.
This may also help if you are unsure.
http://homepages.e3.net.nz/~djm/cppcontainers.html
Topic archived. No new replies allowed.