y_queue "cpp/container/priority
queue")  
[ flat_set  ](/w/cpp/container/flat_set "cpp/container/flat set") (C++23)  
[ flat_multiset  ](/w/cpp/container/flat_multiset "cpp/container/flat
multiset") (C++23)  
[ flat_map  ](/w/cpp/container/flat_map "cpp/container/flat map") (C++23)  
[ flat_multimap  ](/w/cpp/container/flat_multimap "cpp/container/flat
multimap") (C++23)  
[ Views ](/w/cpp/container#Views "cpp/container")  
[ span  ](/w/cpp/container/span "cpp/container/span") (C++20)  
[ mdspan  ](/w/cpp/container/mdspan "cpp/container/mdspan") (C++23)  
[ Iterator invalidation ](/w/cpp/container#Iterator_invalidation
"cpp/container")  
[ Member function table ](/w/cpp/container#Member_function_table
"cpp/container")  
[ Non-member function table ](/w/cpp/container#Non-member_function_table
"cpp/container")  
  
[ [edit]
](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/container/navbar_content&action=edit)

The Containers library is a generic collection of class templates and
algorithms that allow programmers to easily implement common data structures
like queues, lists and stacks. There are  two  (until C++11)  three  (since
C++11)  classes of containers:

  * sequence containers, 
  * associative containers, and 

  * unordered associative containers, 

|  (since C++11)  
---|---  
  
each of which is designed to support a different set of operations.

The container manages the storage space that is allocated for its elements and
provides member functions to access them, either directly or through iterators
(objects with properties similar to pointers).

Most containers have at least several member functions in common, and share
functionalities. Which container is the best for the particular application
depends not only on the offered functionality, but also on its efficiency for
different workloads.

##  Contents

  * 1  Sequence containers 
  * 2  Associative containers 
  * 3  Unordered associative containers  (since C++11) 
  * 4  Container adaptors 
  * 5  Views 
  * 6  Iterator invalidation 
  * 7  Thread safety 
  * 8  Function table 
    * 8.1  Member function table 
    * 8.2  Non-member function table 
  * 9  Defect reports 
  * 10  See also 

  
---  
  
###  [ [ edit ](/mwiki/index.php?title=cpp/container&action=edit&section=1
"Edit section: Sequence containers") ]  Sequence containers

Sequence containers implement data structures which can be accessed
sequentially.

[ array  ](/w/cpp/container/array "cpp/container/array") (C++11)  |  static contiguous array   
(class template)  [ [edit]
](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/container/dsc_array&action=edit)  
---|---  
[ vector  ](/w/cpp/container/vector "cpp/container/vector") |  dynamic contiguous array   
(class template)  [ [edit]
](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/container/dsc_vector&action=edit)  
[ deque  ](/w/cpp/container/deque "cpp/container/deque") |  double-ended queue   
(class template)  [ [edit]
](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/container/dsc_deque&action=edit)  
[ forward_list  ](/w/cpp/container/forward_list "cpp/container/forward list") (C++11)  |  singly-linked list   
(class template)  [ [edit]
](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/container/dsc_forward_list&action=edit)  
[ list  ](/w/cpp/container/list "cpp/container/list") |  doubly-linked list   
(class template)  [ [edit]
](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/container/dsc_list&action=edit)  
  
###  [ [ edit ](/mwiki/index.php?title=cpp/container&action=edit&section=2
"Edit section: Associative containers") ]  Associative containers

Associative containers implement sorted data structures that can be quickly
searched (  O(log n)  complexity).

[ set  ](/w/cpp/container/set "cpp/container/set") |  collection of unique keys, sorted by keys   
(class template)  [ [edit]
](https://en.cppreference.com/mwiki/index.php?title=Template:cp