std::list does not support indexing
std::vector does
seen from Australia

seen from United Kingdom

seen from Australia

seen from Denmark
seen from Macao SAR China
seen from Germany
seen from China

seen from United States

seen from Canada
seen from United States

seen from United States

seen from Iraq

seen from Canada
seen from China
seen from United States
seen from Japan
seen from Denmark
seen from United States

seen from United States
seen from United States
std::list does not support indexing
std::vector does

Anya is live and ready to show you everything. Watch her strip, dance, and perform exclusive shows just for you. Interact in real-time and make your fantasies come true.
Free to watch • No registration required • HD streaming
std::vector.erase
erase returns an iterator that is positioned on the element that follows the one that we just erased
std::vector.erase is slow
O(n^2) algorithm
Because vectors use an array as their underlying storage, erasing elements in positions other than the vector end causes the container to relocate all the elements after the segment erased to their new positions. This is generally an inefficient operation compared to the one performed for the same operation by other kinds of sequence containers (such as list or forward_list).
std::vector is optimized for fast random access
How to initialize std::vector efficiently
If you need a vector of a fixed size and don't care about default initialization of your elements, don't do
std::vector<type> vectorname(num_elements); //O(n)
Instead do this:
std::vector<type> vectorname; vectorname.reserve(num_ekements) //O(1)

Anya is live and ready to show you everything. Watch her strip, dance, and perform exclusive shows just for you. Interact in real-time and make your fantasies come true.
Free to watch • No registration required • HD streaming
vector<bool> has taken a lot of heat over the past decade, and not without reason. However I believe it is way past time to draw back some of the criticism and explore this area with a dispassionate scrutiny of detail.