Last Updated: May 22, 2026
std::vector is a growable array that stores its elements contiguously in memory. It's the default sequence container in C++, the first choice for any list of things that can grow or shrink. This chapter covers how vectors lay out memory, the difference between size and capacity, how the growth policy works, the full API (push_back, emplace_back, insert, erase, at, operator[], reserve, resize), iterator invalidation rules, and when to use a vector versus another container. The iterator and algorithm chapters later in this section pick up where this one leaves off.