|
|
Line 1,687: |
Line 1,687: |
| ! {{cpp/container/table cell h23 | /flat_multimap }} | | ! {{cpp/container/table cell h23 | /flat_multimap }} |
| |- | | |- |
− | ! rowspan="5" | Non-member function | + | ! rowspan="6" | Non-member function |
| | {{cpp/container/table cell lo | operator{{==}} }} | | | {{cpp/container/table cell lo | operator{{==}} }} |
| | {{cpp/container/table cell n | /array/operator_cmp | operator{{==}} }} | | | {{cpp/container/table cell n | /array/operator_cmp | operator{{==}} }} |
Line 1,704: |
Line 1,704: |
| | {{cpp/container/table cell o | /stack/operator_cmp | operator{{==}} }} | | | {{cpp/container/table cell o | /stack/operator_cmp | operator{{==}} }} |
| | {{cpp/container/table cell o | /queue/operator_cmp | operator{{==}} }} | | | {{cpp/container/table cell o | /queue/operator_cmp | operator{{==}} }} |
− | | {{cpp/container/table cell o | /priority_queue/operator_cmp | operator{{==}} }} | + | | {{n/a|}} |
| | {{cpp/container/table cell 23 | /flat_set/operator_cmp | operator{{==}} }} | | | {{cpp/container/table cell 23 | /flat_set/operator_cmp | operator{{==}} }} |
| | {{cpp/container/table cell 23 | /flat_multiset/operator_cmp | operator{{==}} }} | | | {{cpp/container/table cell 23 | /flat_multiset/operator_cmp | operator{{==}} }} |
| | {{cpp/container/table cell 23 | /flat_map/operator_cmp | operator{{==}} }} | | | {{cpp/container/table cell 23 | /flat_map/operator_cmp | operator{{==}} }} |
| | {{cpp/container/table cell 23 | /flat_multimap/operator_cmp | operator{{==}} }} | | | {{cpp/container/table cell 23 | /flat_multimap/operator_cmp | operator{{==}} }} |
| + | |- |
| + | <!-- ---> |
| + | | {{cpp/container/table cell lo | operator!{{=}} {{mark until c++20|removed=yes}} }} |
| + | | {{cpp/container/table cell n | /array/operator_cmp | operator!{{=}} }} |
| + | | {{cpp/container/table cell o | /vector/operator_cmp | operator!{{=}} }} |
| + | | {{cpp/container/table cell o | /deque/operator_cmp | operator!{{=}} }} |
| + | | {{cpp/container/table cell n | /forward_list/operator_cmp | operator!{{=}} }} |
| + | | {{cpp/container/table cell o | /list/operator_cmp | operator!{{=}} }} |
| + | | {{cpp/container/table cell o | /set/operator_cmp | operator!{{=}} }} |
| + | | {{cpp/container/table cell o | /multiset/operator_cmp | operator!{{=}} }} |
| + | | {{cpp/container/table cell o | /map/operator_cmp | operator!{{=}} }} |
| + | | {{cpp/container/table cell o | /multimap/operator_cmp | operator!{{=}} }} |
| + | | {{cpp/container/table cell n | /unordered_set/operator_cmp | operator!{{=}} }} |
| + | | {{cpp/container/table cell n | /unordered_multiset/operator_cmp | operator!{{=}} }} |
| + | | {{cpp/container/table cell n | /unordered_map/operator_cmp | operator!{{=}} }} |
| + | | {{cpp/container/table cell n | /unordered_multimap/operator_cmp | operator!{{=}} }} |
| + | | {{cpp/container/table cell o | /stack/operator_cmp | operator!{{=}} }} |
| + | | {{cpp/container/table cell o | /queue/operator_cmp | operator!{{=}} }} |
| + | | {{n/a|}} |
| + | | {{n/a|}} |
| + | | {{n/a|}} |
| + | | {{n/a|}} |
| + | | {{n/a|}} |
| |- | | |- |
| <!-- ---> | | <!-- ---> |
Line 1,721: |
Line 1,744: |
| | {{cpp/container/table cell 20 | /map/operator_cmp | operator<{{=}}> }} | | | {{cpp/container/table cell 20 | /map/operator_cmp | operator<{{=}}> }} |
| | {{cpp/container/table cell 20 | /multimap/operator_cmp | operator<{{=}}> }} | | | {{cpp/container/table cell 20 | /multimap/operator_cmp | operator<{{=}}> }} |
− | | {{cpp/container/table cell 20 | /unordered_set/operator_cmp | operator<{{=}}> }} | + | | {{n/a|}} |
− | | {{cpp/container/table cell 20 | /unordered_multiset/operator_cmp | operator<{{=}}> }} | + | | {{n/a|}} |
− | | {{cpp/container/table cell 20 | /unordered_map/operator_cmp | operator<{{=}}> }} | + | | {{n/a|}} |
− | | {{cpp/container/table cell 20 | /unordered_multimap/operator_cmp | operator<{{=}}> }} | + | | {{n/a|}} |
| | {{cpp/container/table cell 20 | /stack/operator_cmp | operator<{{=}}> }} | | | {{cpp/container/table cell 20 | /stack/operator_cmp | operator<{{=}}> }} |
| | {{cpp/container/table cell 20 | /queue/operator_cmp | operator<{{=}}> }} | | | {{cpp/container/table cell 20 | /queue/operator_cmp | operator<{{=}}> }} |
− | | {{cpp/container/table cell 20 | /priority_queue/operator_cmp | operator<{{=}}> }} | + | | {{n/a|}} |
| | {{cpp/container/table cell 23 | /flat_set/operator_cmp | operator<{{=}}> }} | | | {{cpp/container/table cell 23 | /flat_set/operator_cmp | operator<{{=}}> }} |
| | {{cpp/container/table cell 23 | /flat_multiset/operator_cmp | operator<{{=}}> }} | | | {{cpp/container/table cell 23 | /flat_multiset/operator_cmp | operator<{{=}}> }} |
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:
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.
Sequence containers implement data structures which can be accessed sequentially.
Associative containers implement sorted data structures that can be quickly searched (O(log n) complexity).
Unordered associative containers implement unsorted (hashed) data structures that can be quickly searched (O(1) amortized, O(n) worst-case complexity).
Container adaptors provide a different interface for sequential containers.
Read-only methods never invalidate iterators or references. Methods which modify the contents of a container may invalidate iterators and/or references, as summarized in this table.
Unless otherwise specified (either explicitly or by defining a function in terms of other functions), passing a container as an argument to a library function never invalidate iterators to, or change the values of, objects within that container.
The past-the-end iterator deserves particular mention. In general this iterator is invalidated as though it were a normal iterator to a non-erased element. So std::set::end is never invalidated, std::unordered_set::end is invalidated only on rehash(since C++11), std::vector::end is always invalidated (since it is always after the modified elements), and so on.
The following behavior-changing defect reports were applied retroactively to previously published C++ standards.