The Containers library is a generic collection of class templates and algorithms that allow programmers to easily implement standard data structures like queues, lists and stacks. There are three classes of containers -- sequence containers, associative containers, and unordered associative containers -- each of which is designed to support a different set of operations.
[edit] Sequence containers
Sequence containers implement data structures which can be accessed sequentially.
|
|
static contiguous array (class template) [edit]
|
|
|
dynamic contiguous array (class template) [edit]
|
|
|
double-ended queue (class template) [edit]
|
|
|
singly-linked list (class template) [edit]
|
|
|
doubly-linked list (class template) [edit]
|
[edit] Associative containers
Associative containers implement sorted data structures that can be quickly searched (O(log n) complexity).
|
|
collection of unique keys, sorted by keys (class template) [edit]
|
|
|
collection of key-value pairs, sorted by keys, keys are unique (class template) [edit]
|
|
|
collection of keys, sorted by keys (class template) [edit]
|
|
|
collection of key-value pairs, sorted by keys (class template) [edit]
|
[edit] Unordered associative containers
Associative containers implement unsorted (hashed) data structures that can be quickly searched (O(1) amortized, O(n) worst-case complexity).
|
|
collection of unique keys, hashed by keys (class template) [edit]
|
|
|
collection of key-value pairs, hashed by keys, keys are unique (class template) [edit]
|
|
|
collection of keys, hashed by keys (class template) [edit]
|
|
|
collection of key-value pairs, hashed by keys (class template) [edit]
|
[edit] Container adaptors
Container adaptors provide a different interface for sequential containers.
|
|
adapts a container to provide stack (LIFO data structure) (class template) [edit]
|
|
|
adapts a container to provide queue (FIFO data structure) (class template) [edit]
|
|
|
adapts a container to provide priority queue (class template) [edit]
|
[edit] Member function table
|
- functions present in C++03
|
|
- functions present since C++11
|
|
Sequence containers
|
Associative containers
|
Unordered associative containers
|
Container adaptors
|
Headers
|
<array>
|
<vector>
|
<deque>
|
<forward_list>
|
<list>
|
<set>
|
<map>
|
<unordered_set>
|
<unordered_map>
|
<stack>
|
<queue>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(implicit)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(implicit)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(implicit)
|
|
|
|
|
|
|
|
|
|
|
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