23 Containers library [containers]

23.4 Associative containers [associative]

23.4.4 Class template map [map]

23.4.4.3 map element access [map.access]

T& operator[](const key_type& x);

Effects: If there is no key equivalent to x in the map, inserts value_type(x, T()) into the map.

Requires: key_type shall be CopyConstructible and mapped_type shall be DefaultConstructible.

Returns: A reference to the mapped_type corresponding to x in *this.

Complexity: logarithmic.

T& operator[](key_type&& x);

Effects: If there is no key equivalent to x in the map, inserts value_type(std::move(x), T()) into the map.

Requires: mapped_type shall be DefaultConstructible.

Returns: A reference to the mapped_type corresponding to x in *this.

Complexity: logarithmic.

T& at(const key_type& x); const T& 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.