std::unordered_map at() method
- since C++11
// (1) Non const version
T& at( const Key& key );
// (2) Const version
const T& at( const Key& key ) const;
Returns a reference to the mapped value of the element with key equivalent to key
.
If no such element exists, an exception of type std::out_of_range
is thrown.
Parameters
key
- the key of the element to find
Return value
Reference to the mapped value of the requested element.
Complexity
Average case, constant - O(1).
Worst case, linear in size of the containter - O(log size()).
Exceptions
std::out_of_range
if the container does not have an element with the specified key.
Examples
This section requires improvement. You can help by editing this doc page.
Hover to see the original license.