[unord.map.elem] (original) (raw)

23 Containers library [containers]

23.5 Unordered associative containers [unord]

23.5.3 Class template unordered_map [unord.map]

23.5.3.3 Element access [unord.map.elem]

constexpr mapped_type& operator[](const key_type& k);

Effects: Equivalent to: return try_emplace(k).first->second;

constexpr mapped_type& operator[](key_type&& k);

Effects: Equivalent to: return try_emplace(std​::​move(k)).first->second;

template<class K> constexpr mapped_type& operator[](K&& k);

Constraints: The qualified-ids Hash​::​is_transparent andPred​::​is_transparent are valid and denote types.

Effects: Equivalent to: return try_emplace(std​::​forward<K>(k)).first->second;

constexpr mapped_type& at(const key_type& k);constexpr const mapped_type& at(const key_type& k) const;

Returns: A reference to x.second, where x is the (unique) element whose key is equivalent to k.

Throws: An exception object of type out_of_range if no such element is present.

template<class K> constexpr mapped_type& at(const K& k);template<class K> constexpr const mapped_type& at(const K& k) const;

Constraints: The qualified-ids Hash​::​is_transparent andPred​::​is_transparent are valid and denote types.

Preconditions: The expression find(k) is well-formed and has well-defined behavior.

Returns: A reference to find(k)->second.

Throws: An exception object of type out_of_rangeif find(k) == end() is true.