[flat.map.access]

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

## 23.6 Container adaptors [[container.adaptors]](container.adaptors#flat.map.access)

### 23.6.8 Class template flat_map [[flat.map]](flat.map#access)

#### 23.6.8.6 Access [flat.map.access]

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

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

[1](#1)

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

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

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

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

[2](#2)

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

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

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

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

[3](#3)

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

*Constraints*: The [*qualified-id*](expr.prim.id.qual#nt:qualified-id "7.5.5.3 Qualified names [expr.prim.id.qual]") Compare​::​is_transparent is valid and
denotes a type[.](#3.sentence-1)

[4](#4)

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

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

[ð](#lib:at,flat_map)

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

[5](#5)

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

*Returns*: A reference to the mapped_type corresponding
to x in *this[.](#5.sentence-1)

[6](#6)

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

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

[7](#7)

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

*Complexity*: Logarithmic[.](#7.sentence-1)

[ð](#lib:at,flat_map_)

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

[8](#8)

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

*Constraints*: The [*qualified-id*](expr.prim.id.qual#nt:qualified-id "7.5.5.3 Qualified names [expr.prim.id.qual]") Compare​::​is_transparent is valid and denotes a type[.](#8.sentence-1)

[9](#9)

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

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

[10](#10)

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

*Returns*: A reference to the mapped_type corresponding tox in *this[.](#10.sentence-1)

[11](#11)

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

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

[12](#12)

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

*Complexity*: Logarithmic[.](#12.sentence-1)
