[unord.map.elem]

# 23 Containers library [[containers]](./#containers)

## 23.5 Unordered associative containers [[unord]](unord#map.elem)

### 23.5.3 Class template unordered_map [[unord.map]](unord.map#elem)

#### 23.5.3.3 Element access [unord.map.elem]

[ð](#lib:unordered_map,operator%5b%5d)

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

[1](#1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L13803)

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

[ð](#lib:unordered_map,operator%5b%5d_)

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

[2](#2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L13815)

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

[ð](#lib:unordered_map,operator%5b%5d__)

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

[3](#3)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L13827)

*Constraints*: The [*qualified-id*](expr.prim.id.qual#nt:qualified-id "7.5.5.3 Qualified names [expr.prim.id.qual]")*s* Hash​::​is_transparent andPred​::​is_transparent are valid and denote types[.](#3.sentence-1)

[4](#4)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L13832)

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

[ð](#lib:unordered_map,at)

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

[5](#5)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L13845)

*Returns*: A reference to x.second, where x is the (unique) element whose key is equivalent to k[.](#5.sentence-1)

[6](#6)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L13849)

*Throws*: An exception object of type out_of_range if no such element is present[.](#6.sentence-1)

[ð](#lib:unordered_map,at_)

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

[7](#7)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L13862)

*Constraints*: The [*qualified-id*](expr.prim.id.qual#nt:qualified-id "7.5.5.3 Qualified names [expr.prim.id.qual]")*s* Hash​::​is_transparent andPred​::​is_transparent are valid and denote types[.](#7.sentence-1)

[8](#8)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L13867)

*Preconditions*: The expression find(k) is well-formed and has well-defined behavior[.](#8.sentence-1)

[9](#9)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L13871)

*Returns*: A reference to find(k)->second[.](#9.sentence-1)

[10](#10)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L13875)

*Throws*: An exception object of type out_of_range if find(k) == end() is true[.](#10.sentence-1)
