Relative Content

Tag Archive for stl

Two-Dimensional vector in C++ – inefficient with dynamic-sized sub vectors?

I know that std::vector uses a contiguous block of memory, but I often see people use vectors of vectors, even when they modify the number of elements in these vectors contained within an outer vector. Won’t this lead to efficiency problems when an inner vector need to be resized as all the following vectors will have to have their elements moved as well?