std::vector in C++ — a practical guide to C++ std::vector with clear examples you can reuse in real projects.
C++ Tutorial Series (82/111). Prefer one article? Read the complete C++ tutorial.
Short description
Reserve capacity when size is predictable; prefer push_back/emplace_back.
vector
#include <vector>
std::vector<int> v = {1, 2, 3};
v.push_back(4);