23 Containers library [containers]

23.4 Associative containers [associative]

23.4.3 Class template map [map]

23.4.3.3 Element access [map.access]

constexpr mapped_type& operator[](const key_type& x);
Effects: Equivalent to: return try_emplace(x).first->second;
constexpr mapped_type& operator[](key_type&& x);
Effects: Equivalent to: return try_emplace(std​::​move(x)).first->second;
template<class K> constexpr mapped_type& operator[](K&& x);
Constraints: The qualified-id Compare​::​is_transparent is valid and denotes a type.
Effects: Equivalent to: return try_emplace(std​::​forward<K>(x)).first->second;
constexpr mapped_type& at(const key_type& x); constexpr const mapped_type& at(const key_type& x) const;
Returns: A reference to the mapped_type corresponding to x in *this.
Throws: An exception object of type out_of_range if no such element is present.
Complexity: Logarithmic.
template<class K> constexpr mapped_type& at(const K& x); template<class K> constexpr const mapped_type& at(const K& x) const;
Constraints: The qualified-id Compare​::​is_transparent is valid and denotes a type.
Preconditions: The expression find(x) is well-formed and has well-defined behavior.
Returns: A reference to find(x)->second.
Throws: An exception object of type out_of_range if find(x) == end() is true.
Complexity: Logarithmic.
constexpr optional<mapped_type&> lookup(const key_type& x); constexpr optional<const mapped_type&> lookup(const key_type& x) const; template<class K> constexpr optional<mapped_type&> lookup(const K& x); template<class K> constexpr optional<const mapped_type&> lookup(const K& x) const;
Constraints: For the third and fourth overloads, the qualified-id Compare​::​is_transparent is valid and denotes a type.
Preconditions: The expression find(x) is well-formed and has well-defined behavior.
Returns: find(x)->second if contains(x) is true, otherwise nullopt.
Complexity: Logarithmic.