(C++17) | ||||
| Sequence | ||||
(C++11) | ||||
(C++26) | ||||
(C++26) | ||||
(C++11) | ||||
| Associative | ||||
| Unordered associative | ||||
(C++11) | ||||
(C++11) | ||||
(C++11) | ||||
(C++11) | ||||
| Adaptors | ||||
(C++23) | ||||
(C++23) | ||||
(C++23) | ||||
(C++23) | ||||
| Views | ||||
(C++20) | ||||
(C++23) | ||||
| Tables | ||||
| Iterator invalidation | ||||
| Member function table | ||||
| Non-member function table |
| Member types | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Member functions | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Non-member functions | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Deduction guides(C++17) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
T& at(const Key& key); | (1) | (since C++11) |
const T& at(const Key& key)const; | (2) | (since C++11) |
template<class K> T& at(const K& x); | (3) | (since C++26) |
template<class K> const T& at(const K& x)const; | (4) | (since C++26) |
Returns a reference to the mapped value of the element with specified key. If no such element exists, an exception of typestd::out_of_range is thrown.
Hash andKeyEqual are bothtransparent. This assumes that suchHash is callable with bothK andKey type, and that theKeyEqual is transparent, which, together, allows calling this function without constructing an instance ofKey.Contents |
| key | - | the key of the element to find |
| x | - | a value of any type that can be transparently compared with a key |
A reference to the mapped value of the requested element.
Average case: constant, worst case: linear in size.
| Feature-test macro | Value | Std | Feature |
|---|---|---|---|
__cpp_lib_associative_heterogeneous_insertion | 202311L | (C++26) | Heterogeneous overloads for the remaining member functions inordered andunordered associativecontainers.(3,4) |
| This section is incomplete Reason: no example |
| access or insert specified element (public member function)[edit] | |
| finds element with specific key (public member function)[edit] |