All C++ Containers

All C++ Containers

A compact scan page listing the main standard C++ containers, adapters, and contiguous views.

How to use this reference page

Use reference pages to confirm names, categories, nearby facilities, and the constraints that matter before writing or reviewing code.

  • Scan the top of the page first to identify the primary types, functions, or algorithm families involved.
  • Use the nearby-page links when your question is really about a companion header, related algorithm family, or broader subsystem.
  • Validate tricky behavior with a small compileable example before relying on memory for details like invalidation, ordering, allocation, or lifetime rules.

All C++ Containers

This page is optimized for scanning. Use C++ containers and views when you want a fuller explanation.

Sequence containers

Ordered associative containers

Unordered associative containers

Container adapters

Views and adjacent non-owning types

Practical use

Example in practice

#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;
}