All Sequence-Container Modifier Operations
All Sequence-Container Modifier Operations
A compact scan page for the core insertion, erase, resize, and structural modifier operations shared across sequence containers.
All Sequence-Container Modifier Operations
A compact scan page for the core insertion, erase, resize, and structural modifier operations shared across sequence containers.
Use reference pages to confirm names, categories, nearby facilities, and the constraints that matter before writing or reviewing code.
push_backpush_front where supportedemplace_backemplace_front where supportedinsertemplaceeraseclearresizeassignswapvector and deque support indexed insertion/erase around iterator positionslist and forward_list support splice-like or before-iterator workflowsarray has fixed size, so structural growth/shrink operations do not existvector when repeated growth is predictable.#include <map>
#include <string>
int main() {
std::map<std::string, int> counts{std::pair{"Ada", 1}, std::pair{"Bjarne", 2}};
auto [it, inserted] = counts.insert({"Grace", 3});
return inserted ? it->second : 1;
}