---
name: "std::unordered_map"
section: "3"
platform: "linux"
package: "gcc"
version: "16.2.1+r23+gd564253eb6c8-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/std::unordered_map"
---

# std::unordered\_map(3)

A standard container composed of unique keys (containing at most one of each key value) that associates values of another type with the keys.

## NAME

std::unordered\_map\< \_Key, \_Tp, \_Hash, \_Pred, \_Alloc \> - A standard container composed of unique keys (containing at most one of each key value) that associates values of another type with the keys.

## SYNOPSIS

\#include \<unordered\_map\>

### Public Types

typedef \_Hashtable::key\_type **key\_type**\
 Public typedefs.  typedef \_Hashtable::value\_type **value\_type**\
 Public typedefs.  typedef \_Hashtable::mapped\_type **mapped\_type**\
 Public typedefs.  typedef \_Hashtable::hasher **hasher**\
 Public typedefs.  typedef \_Hashtable::key\_equal **key\_equal**\
 Public typedefs.  typedef \_Hashtable::allocator\_type **allocator\_type**\
 Public typedefs.

typedef \_Hashtable::pointer **pointer**\
 Iterator-related typedefs.  typedef \_Hashtable::const\_pointer **const\_pointer**\
 Iterator-related typedefs.  typedef \_Hashtable::reference **reference**\
 Iterator-related typedefs.  typedef \_Hashtable::const\_reference **const\_reference**\
 Iterator-related typedefs.  typedef \_Hashtable::iterator **iterator**\
 Iterator-related typedefs.  typedef \_Hashtable::const\_iterator **const\_iterator**\
 Iterator-related typedefs.  typedef \_Hashtable::local\_iterator **local\_iterator**\
 Iterator-related typedefs.  typedef \_Hashtable::const\_local\_iterator **const\_local\_iterator**\
 Iterator-related typedefs.  typedef \_Hashtable::size\_type **size\_type**\
 Iterator-related typedefs.  typedef \_Hashtable::difference\_type **difference\_type**\
 Iterator-related typedefs.

### Public Member Functions

**unordered\_map** ()=default\
 Default constructor.  template\<typename \_InputIterator\> **unordered\_map** (\_InputIterator \_\_first, \_InputIterator \_\_last, const **allocator\_type** &\_\_a)\
 template\<typename \_InputIterator\> **unordered\_map** (\_InputIterator \_\_first, \_InputIterator \_\_last, **size\_type** \_\_n, const **allocator\_type** &\_\_a)\
 template\<typename \_InputIterator\> **unordered\_map** (\_InputIterator \_\_first, \_InputIterator \_\_last, **size\_type** \_\_n, const **hasher** &\_\_hf, const **allocator\_type** &\_\_a)\
 template\<typename \_InputIterator\> **unordered\_map** (\_InputIterator \_\_first, \_InputIterator \_\_last, **size\_type** \_\_n=0, const **hasher** &\_\_hf=**hasher**(), const **key\_equal** &\_\_eql=**key\_equal**(), const **allocator\_type** &\_\_a=**allocator\_type**())\
 Builds an unordered\_map from a range.  **unordered\_map** (const **allocator\_type** &\_\_a)\
 Creates an unordered\_map with no elements.  **unordered\_map** (const unordered\_map &)=default\
 Copy constructor.  **unordered\_map** (const unordered\_map &\_\_umap, const **allocator\_type** &\_\_a)\
 **unordered\_map** (**initializer\_list**\< **value\_type** \> \_\_l, const **allocator\_type** &\_\_a)\
 **unordered\_map** (**initializer\_list**\< **value\_type** \> \_\_l, **size\_type** \_\_n, const **allocator\_type** &\_\_a)\
 **unordered\_map** (**initializer\_list**\< **value\_type** \> \_\_l, **size\_type** \_\_n, const **hasher** &\_\_hf, const **allocator\_type** &\_\_a)\
 **unordered\_map** (**initializer\_list**\< **value\_type** \> \_\_l, **size\_type** \_\_n=0, const **hasher** &\_\_hf=**hasher**(), const **key\_equal** &\_\_eql=**key\_equal**(), const **allocator\_type** &\_\_a=**allocator\_type**())\
 Builds an unordered\_map from an initializer\_list.  **unordered\_map** (**size\_type** \_\_n, const **allocator\_type** &\_\_a)\
 **unordered\_map** (**size\_type** \_\_n, const **hasher** &\_\_hf, const **allocator\_type** &\_\_a)\
 **unordered\_map** (**size\_type** \_\_n, const **hasher** &\_\_hf=**hasher**(), const **key\_equal** &\_\_eql=**key\_equal**(), const **allocator\_type** &\_\_a=**allocator\_type**())\
 Default constructor creates no elements.  **unordered\_map** (unordered\_map &&)=default\
 Move constructor.  **unordered\_map** (unordered\_map &&\_\_umap, const **allocator\_type** &\_\_a) noexcept(noexcept(\_Hashtable(**std::move**(\_\_umap.\_M\_h), \_\_a)))\
 **iterator** **begin** () noexcept\
 **local\_iterator** **begin** (**size\_type** \_\_n)\
 Returns a read/write iterator pointing to the first bucket element.  **size\_type** **bucket\_count** () const noexcept\
 Returns the number of buckets of the unordered\_map.  **size\_type** **bucket\_size** (**size\_type** \_\_n) const\
 void **clear** () noexcept\
 template\<typename... \_Args\> **std::pair**\< **iterator**, bool \> **emplace** (\_Args &&... \_\_args)\
 Attempts to build and insert a std::pair into the unordered\_map.  template\<typename... \_Args\> **iterator** **emplace\_hint** (**const\_iterator** \_\_pos, \_Args &&... \_\_args)\
 Attempts to build and insert a std::pair into the unordered\_map.  bool **empty** () const noexcept\
 Returns true if the unordered\_map is empty.  **iterator** **end** () noexcept\
 **local\_iterator** **end** (**size\_type** \_\_n)\
 Returns a read/write iterator pointing to one past the last bucket elements.  **iterator** **erase** (**const\_iterator** \_\_first, **const\_iterator** \_\_last)\
 Erases a \[\_\_first,\_\_last) range of elements from an unordered\_map.  **allocator\_type** **get\_allocator** () const noexcept\
 Returns the allocator object used by the unordered\_map.  **hasher** **hash\_function** () const\
 Returns the hash functor object with which the unordered\_map was constructed.  template\<typename \_InputIterator\> void **insert** (\_InputIterator \_\_first, \_InputIterator \_\_last)\
 A template function that attempts to insert a range of elements.  void **insert** (**initializer\_list**\< **value\_type** \> \_\_l)\
 Attempts to insert a list of elements into the unordered\_map.  **key\_equal** **key\_eq** () const\
 Returns the key comparison object with which the unordered\_map was constructed.  float **load\_factor** () const noexcept\
 Returns the average number of elements per bucket.  **size\_type** **max\_bucket\_count** () const noexcept\
 Returns the maximum number of buckets of the unordered\_map.  float **max\_load\_factor** () const noexcept\
 Returns a positive number that the unordered\_map tries to keep the load factor less than or equal to.  void **max\_load\_factor** (float \_\_z)\
 Change the unordered\_map maximum load factor.  **size\_type** **max\_size** () const noexcept\
 Returns the maximum size of the unordered\_map.  **unordered\_map** & **operator=** (const **unordered\_map** &)=default\
 Copy assignment operator.  **unordered\_map** & **operator=** (**initializer\_list**\< **value\_type** \> \_\_l)\
 Unordered\_map list assignment operator.  **unordered\_map** & **operator=** (**unordered\_map** &&)=default\
 Move assignment operator.  void **rehash** (**size\_type** \_\_n)\
 May rehash the unordered\_map.  void **reserve** (**size\_type** \_\_n)\
 Prepare the unordered\_map for a specified number of elements.  **size\_type** **size** () const noexcept\
 Returns the size of the unordered\_map.  void **swap** (**unordered\_map** &\_\_x) noexcept(noexcept(\_M\_h.swap(\_\_x.\_M\_h)))\
 Swaps data with another unordered\_map.

**const\_iterator** **begin** () const noexcept\
 **const\_iterator** **cbegin** () const noexcept\

**const\_iterator** **end** () const noexcept\
 **const\_iterator** **cend** () const noexcept\

**std::pair**\< **iterator**, bool \> **insert** (const **value\_type** &\_\_x)\
 Attempts to insert a std::pair into the unordered\_map.  **std::pair**\< **iterator**, bool \> **insert** (**value\_type** &&\_\_x)\
 Attempts to insert a std::pair into the unordered\_map.  template\<typename \_Pair\> \_\_enable\_if\_t\< **is\_constructible**\< **value\_type**, \_Pair && \>::value, **pair**\< **iterator**, bool \> \> **insert** (\_Pair &&\_\_x)\
 Attempts to insert a std::pair into the unordered\_map.

**iterator** **insert** (**const\_iterator** \_\_hint, const **value\_type** &\_\_x)\
 Attempts to insert a std::pair into the unordered\_map.  **iterator** **insert** (**const\_iterator** \_\_hint, **value\_type** &&\_\_x)\
 Attempts to insert a std::pair into the unordered\_map.  template\<typename \_Pair\> \_\_enable\_if\_t\< **is\_constructible**\< **value\_type**, \_Pair && \>::value, **iterator** \> **insert** (**const\_iterator** \_\_hint, \_Pair &&\_\_x)\
 Attempts to insert a std::pair into the unordered\_map.

**iterator** **erase** (**const\_iterator** \_\_position)\
 Erases an element from an unordered\_map.  **iterator** **erase** (**iterator** \_\_position)\
 Erases an element from an unordered\_map.

**size\_type** **erase** (const **key\_type** &\_\_x)\
 Erases elements according to the provided key.  template\<\_\_heterogeneous\_hash\_key\< **unordered\_map** \> \_Kt\> **size\_type** **erase** (\_Kt &&\_\_x)\
 Erases elements according to the provided key.

**iterator** **find** (const **key\_type** &\_\_x)\
 Tries to locate an element in an unordered\_map.  **const\_iterator** **find** (const **key\_type** &\_\_x) const\
 Tries to locate an element in an unordered\_map.

**size\_type** **count** (const **key\_type** &\_\_x) const\
 Finds the number of elements.

bool **contains** (const **key\_type** &\_\_x) const\
 Finds whether an element with the given key exists.  template\<typename \_Kt\> auto **contains** (const \_Kt &\_\_x) const -\> decltype(\_M\_h.\_M\_find\_tr(\_\_x), void(), true)\
 Finds whether an element with the given key exists.

**std::pair**\< **iterator**, **iterator** \> **equal\_range** (const **key\_type** &\_\_x)\
 Finds a subsequence matching given key.  **std::pair**\< **const\_iterator**, **const\_iterator** \> **equal\_range** (const **key\_type** &\_\_x) const\
 Finds a subsequence matching given key.

**mapped\_type** & **operator\[\]** (const **key\_type** &\_\_k)\
 Subscript ( \[\] ) access to unordered\_map data.  **mapped\_type** & **operator\[\]** (**key\_type** &&\_\_k)\
 Subscript ( \[\] ) access to unordered\_map data.  template\<\_\_heterogeneous\_hash\_key\< **unordered\_map** \> \_Kt\> **mapped\_type** & **operator\[\]** (\_Kt &&\_\_k)\
 Subscript ( \[\] ) access to unordered\_map data.

**mapped\_type** & **at** (const **key\_type** &\_\_k)\
 Access to unordered\_map data.  template\<\_\_heterogeneous\_hash\_key\< **unordered\_map** \> \_Kt\> **mapped\_type** & **at** (const \_Kt &\_\_k)\
 Access to unordered\_map data.  const **mapped\_type** & **at** (const **key\_type** &\_\_k) const\
 Access to unordered\_map data.  template\<\_\_heterogeneous\_hash\_key\< **unordered\_map** \> \_Kt\> const **mapped\_type** & **at** (const \_Kt &\_\_k) const\
 Access to unordered\_map data.

**size\_type** **bucket** (const **key\_type** &\_\_key) const\
 template\<\_\_heterogeneous\_hash\_key\< **unordered\_map** \> \_Kt\> **size\_type** **bucket** (const \_Kt &\_\_key) const\

**const\_local\_iterator** **begin** (**size\_type** \_\_n) const\
 Returns a read-only (constant) iterator pointing to the first bucket element.  **const\_local\_iterator** **cbegin** (**size\_type** \_\_n) const\
 Returns a read-only (constant) iterator pointing to the first bucket element.

**const\_local\_iterator** **end** (**size\_type** \_\_n) const\
 Returns a read-only (constant) iterator pointing to one past the last bucket elements.  **const\_local\_iterator** **cend** (**size\_type** \_\_n) const\
 Returns a read-only (constant) iterator pointing to one past the last bucket elements.

### Friends

template\<typename \_Key1, typename \_Tp1, typename \_Hash1, typename \_Pred1, typename \_Alloc1\> bool **operator==** (const **unordered\_map**\< \_Key1, \_Tp1, \_Hash1, \_Pred1, \_Alloc1 \> &, const **unordered\_map**\< \_Key1, \_Tp1, \_Hash1, \_Pred1, \_Alloc1 \> &)\

## Detailed Description

### template\<typename \_Key, typename \_Tp, typename \_Hash = hash\<\_Key\>, typename \_Pred = equal\_to\<\_Key\>, typename \_Alloc = allocator\<std::pair\<const \_Key, \_Tp\>\>\>

class std::unordered\_map\< \_Key, \_Tp, \_Hash, \_Pred, \_Alloc \>"A standard container composed of unique keys (containing at most one of each key value) that associates values of another type with the keys.

**Since**

C++11

**Template Parameters**

*\_Key* Type of key objects. \
 *\_Tp* Type of mapped objects. \
 *\_Hash* Hashing function object type, defaults to hash\<\_Key\>. \
 *\_Pred* Predicate function object type, defaults to equal\_to\<\_Key\>. \
 *\_Alloc* Allocator type, defaults to std::allocator\<std::pair\<const \_Key, \_Tp\>\>.

Meets the requirements of a container, and unordered associative container

The resulting value type of the container is std::pair\<const \_Key, \_Tp\>.

Base is \_Hashtable, dispatched at compile time via template alias \_\_umap\_hashtable.

## Member Typedef Documentation

### template\<typename \_Key, typename \_Tp, typename \_Hash = hash\<\_Key\>, typename \_Pred = equal\_to\<\_Key\>, typename \_Alloc = allocator\<std::pair\<const \_Key, \_Tp\>\>\> typedef \_Hashtable::allocator\_type std::unordered\_map\< \_Key, \_Tp, \_Hash, \_Pred, \_Alloc \>::allocator\_type

Public typedefs.

### template\<typename \_Key, typename \_Tp, typename \_Hash = hash\<\_Key\>, typename \_Pred = equal\_to\<\_Key\>, typename \_Alloc = allocator\<std::pair\<const \_Key, \_Tp\>\>\> typedef \_Hashtable::const\_iterator std::unordered\_map\< \_Key, \_Tp, \_Hash, \_Pred, \_Alloc \>::const\_iterator

Iterator-related typedefs.

### template\<typename \_Key, typename \_Tp, typename \_Hash = hash\<\_Key\>, typename \_Pred = equal\_to\<\_Key\>, typename \_Alloc = allocator\<std::pair\<const \_Key, \_Tp\>\>\> typedef \_Hashtable::const\_local\_iterator std::unordered\_map\< \_Key, \_Tp, \_Hash, \_Pred, \_Alloc \>::const\_local\_iterator

Iterator-related typedefs.

### template\<typename \_Key, typename \_Tp, typename \_Hash = hash\<\_Key\>, typename \_Pred = equal\_to\<\_Key\>, typename \_Alloc = allocator\<std::pair\<const \_Key, \_Tp\>\>\> typedef \_Hashtable::const\_pointer std::unordered\_map\< \_Key, \_Tp, \_Hash, \_Pred, \_Alloc \>::const\_pointer

Iterator-related typedefs.

### template\<typename \_Key, typename \_Tp, typename \_Hash = hash\<\_Key\>, typename \_Pred = equal\_to\<\_Key\>, typename \_Alloc = allocator\<std::pair\<const \_Key, \_Tp\>\>\> typedef \_Hashtable::const\_reference std::unordered\_map\< \_Key, \_Tp, \_Hash, \_Pred, \_Alloc \>::const\_reference

Iterator-related typedefs.

### template\<typename \_Key, typename \_Tp, typename \_Hash = hash\<\_Key\>, typename \_Pred = equal\_to\<\_Key\>, typename \_Alloc = allocator\<std::pair\<const \_Key, \_Tp\>\>\> typedef \_Hashtable::difference\_type std::unordered\_map\< \_Key, \_Tp, \_Hash, \_Pred, \_Alloc \>::difference\_type

Iterator-related typedefs.

### template\<typename \_Key, typename \_Tp, typename \_Hash = hash\<\_Key\>, typename \_Pred = equal\_to\<\_Key\>, typename \_Alloc = allocator\<std::pair\<const \_Key, \_Tp\>\>\> typedef \_Hashtable::hasher std::unordered\_map\< \_Key, \_Tp, \_Hash, \_Pred, \_Alloc \>::hasher

Public typedefs.

### template\<typename \_Key, typename \_Tp, typename \_Hash = hash\<\_Key\>, typename \_Pred = equal\_to\<\_Key\>, typename \_Alloc = allocator\<std::pair\<const \_Key, \_Tp\>\>\> typedef \_Hashtable::iterator std::unordered\_map\< \_Key, \_Tp, \_Hash, \_Pred, \_Alloc \>::iterator

Iterator-related typedefs.

### template\<typename \_Key, typename \_Tp, typename \_Hash = hash\<\_Key\>, typename \_Pred = equal\_to\<\_Key\>, typename \_Alloc = allocator\<std::pair\<const \_Key, \_Tp\>\>\> typedef \_Hashtable::key\_equal std::unordered\_map\< \_Key, \_Tp, \_Hash, \_Pred, \_Alloc \>::key\_equal

Public typedefs.

### template\<typename \_Key, typename \_Tp, typename \_Hash = hash\<\_Key\>, typename \_Pred = equal\_to\<\_Key\>, typename \_Alloc = allocator\<std::pair\<const \_Key, \_Tp\>\>\> typedef \_Hashtable::key\_type std::unordered\_map\< \_Key, \_Tp, \_Hash, \_Pred, \_Alloc \>::key\_type

Public typedefs.

### template\<typename \_Key, typename \_Tp, typename \_Hash = hash\<\_Key\>, typename \_Pred = equal\_to\<\_Key\>, typename \_Alloc = allocator\<std::pair\<const \_Key, \_Tp\>\>\> typedef \_Hashtable::local\_iterator std::unordered\_map\< \_Key, \_Tp, \_Hash, \_Pred, \_Alloc \>::local\_iterator

Iterator-related typedefs.

### template\<typename \_Key, typename \_Tp, typename \_Hash = hash\<\_Key\>, typename \_Pred = equal\_to\<\_Key\>, typename \_Alloc = allocator\<std::pair\<const \_Key, \_Tp\>\>\> typedef \_Hashtable::mapped\_type std::unordered\_map\< \_Key, \_Tp, \_Hash, \_Pred, \_Alloc \>::mapped\_type

Public typedefs.

### template\<typename \_Key, typename \_Tp, typename \_Hash = hash\<\_Key\>, typename \_Pred = equal\_to\<\_Key\>, typename \_Alloc = allocator\<std::pair\<const \_Key, \_Tp\>\>\> typedef \_Hashtable::pointer std::unordered\_map\< \_Key, \_Tp, \_Hash, \_Pred, \_Alloc \>::pointer

Iterator-related typedefs.

### template\<typename \_Key, typename \_Tp, typename \_Hash = hash\<\_Key\>, typename \_Pred = equal\_to\<\_Key\>, typename \_Alloc = allocator\<std::pair\<const \_Key, \_Tp\>\>\> typedef \_Hashtable::reference std::unordered\_map\< \_Key, \_Tp, \_Hash, \_Pred, \_Alloc \>::reference

Iterator-related typedefs.

### template\<typename \_Key, typename \_Tp, typename \_Hash = hash\<\_Key\>, typename \_Pred = equal\_to\<\_Key\>, typename \_Alloc = allocator\<std::pair\<const \_Key, \_Tp\>\>\> typedef \_Hashtable::size\_type std::unordered\_map\< \_Key, \_Tp, \_Hash, \_Pred, \_Alloc \>::size\_type

Iterator-related typedefs.

### template\<typename \_Key, typename \_Tp, typename \_Hash = hash\<\_Key\>, typename \_Pred = equal\_to\<\_Key\>, typename \_Alloc = allocator\<std::pair\<const \_Key, \_Tp\>\>\> typedef \_Hashtable::value\_type std::unordered\_map\< \_Key, \_Tp, \_Hash, \_Pred, \_Alloc \>::value\_type

Public typedefs.

## Constructor & Destructor Documentation

### template\<typename \_Key, typename \_Tp, typename \_Hash = hash\<\_Key\>, typename \_Pred = equal\_to\<\_Key\>, typename \_Alloc = allocator\<std::pair\<const \_Key, \_Tp\>\>\> std::unordered\_map\< \_Key, \_Tp, \_Hash, \_Pred, \_Alloc \>::unordered\_map () \[default\]

Default constructor.

### template\<typename \_Key, typename \_Tp, typename \_Hash = hash\<\_Key\>, typename \_Pred = equal\_to\<\_Key\>, typename \_Alloc = allocator\<std::pair\<const \_Key, \_Tp\>\>\> std::unordered\_map\< \_Key, \_Tp, \_Hash, \_Pred, \_Alloc \>::unordered\_map (size\_type \_\_n, const hasher & \_\_hf = hasher(), const key\_equal & \_\_eql = key\_equal(), const allocator\_type & \_\_a = allocator\_type()) \[inline\], \[explicit\]

Default constructor creates no elements.

**Parameters**

*\_\_n* Minimal initial number of buckets. \
 *\_\_hf* A hash functor. \
 *\_\_eql* A key equality functor. \
 *\_\_a* An allocator object.

### template\<typename \_Key, typename \_Tp, typename \_Hash = hash\<\_Key\>, typename \_Pred = equal\_to\<\_Key\>, typename \_Alloc = allocator\<std::pair\<const \_Key, \_Tp\>\>\> template\<typename \_InputIterator\> std::unordered\_map\< \_Key, \_Tp, \_Hash, \_Pred, \_Alloc \>::unordered\_map (\_InputIterator \_\_first, \_InputIterator \_\_last, size\_type \_\_n = 0, const hasher & \_\_hf = hasher(), const key\_equal & \_\_eql = key\_equal(), const allocator\_type & \_\_a = allocator\_type()) \[inline\]

Builds an unordered\_map from a range.

**Parameters**

*\_\_first* An input iterator. \
 *\_\_last* An input iterator. \
 *\_\_n* Minimal initial number of buckets. \
 *\_\_hf* A hash functor. \
 *\_\_eql* A key equality functor. \
 *\_\_a* An allocator object.

Create an unordered\_map consisting of copies of the elements from \[\_\_first,\_\_last). This is linear in N (where N is distance(\_\_first,\_\_last)).

### template\<typename \_Key, typename \_Tp, typename \_Hash = hash\<\_Key\>, typename \_Pred = equal\_to\<\_Key\>, typename \_Alloc = allocator\<std::pair\<const \_Key, \_Tp\>\>\> std::unordered\_map\< \_Key, \_Tp, \_Hash, \_Pred, \_Alloc \>::unordered\_map (const unordered\_map\< \_Key, \_Tp, \_Hash, \_Pred, \_Alloc \> & ) \[default\]

Copy constructor.

### template\<typename \_Key, typename \_Tp, typename \_Hash = hash\<\_Key\>, typename \_Pred = equal\_to\<\_Key\>, typename \_Alloc = allocator\<std::pair\<const \_Key, \_Tp\>\>\> std::unordered\_map\< \_Key, \_Tp, \_Hash, \_Pred, \_Alloc \>::unordered\_map (unordered\_map\< \_Key, \_Tp, \_Hash, \_Pred, \_Alloc \> && ) \[default\]

Move constructor.

### template\<typename \_Key, typename \_Tp, typename \_Hash = hash\<\_Key\>, typename \_Pred = equal\_to\<\_Key\>, typename \_Alloc = allocator\<std::pair\<const \_Key, \_Tp\>\>\> std::unordered\_map\< \_Key, \_Tp, \_Hash, \_Pred, \_Alloc \>::unordered\_map (const allocator\_type & \_\_a) \[inline\], \[explicit\]

Creates an unordered\_map with no elements.

**Parameters**

*\_\_a* An allocator object.

### template\<typename \_Key, typename \_Tp, typename \_Hash = hash\<\_Key\>, typename \_Pred = equal\_to\<\_Key\>, typename \_Alloc = allocator\<std::pair\<const \_Key, \_Tp\>\>\> std::unordered\_map\< \_Key, \_Tp, \_Hash, \_Pred, \_Alloc \>::unordered\_map (initializer\_list\< value\_type \> \_\_l, size\_type \_\_n = 0, const hasher & \_\_hf = hasher(), const key\_equal & \_\_eql = key\_equal(), const allocator\_type & \_\_a = allocator\_type()) \[inline\]

Builds an unordered\_map from an initializer\_list.

**Parameters**

*\_\_l* An initializer\_list. \
 *\_\_n* Minimal initial number of buckets. \
 *\_\_hf* A hash functor. \
 *\_\_eql* A key equality functor. \
 *\_\_a* An allocator object.

Create an unordered\_map consisting of copies of the elements in the list. This is linear in N (where N is *\_\_l.size()*).

## Member Function Documentation

### template\<typename \_Key, typename \_Tp, typename \_Hash = hash\<\_Key\>, typename \_Pred = equal\_to\<\_Key\>, typename \_Alloc = allocator\<std::pair\<const \_Key, \_Tp\>\>\> template\<\_\_heterogeneous\_hash\_key\< unordered\_map \> \_Kt\> mapped\_type & std::unordered\_map\< \_Key, \_Tp, \_Hash, \_Pred, \_Alloc \>::at (const \_Kt & \_\_k) \[inline\]

Access to unordered\_map data.

**Parameters**

*\_\_k* The key for which data should be retrieved.

**Returns**

A reference to the data whose key is equal to *\_\_k*, if such a data is present in the unordered\_map.

**Exceptions**

**std::out\_of\_range If no such data is present.**

### template\<typename \_Key, typename \_Tp, typename \_Hash = hash\<\_Key\>, typename \_Pred = equal\_to\<\_Key\>, typename \_Alloc = allocator\<std::pair\<const \_Key, \_Tp\>\>\> template\<\_\_heterogeneous\_hash\_key\< unordered\_map \> \_Kt\> const mapped\_type & std::unordered\_map\< \_Key, \_Tp, \_Hash, \_Pred, \_Alloc \>::at (const \_Kt & \_\_k) const \[inline\]

**Access to unordered\_map data.**

**Parameters**

*\_\_k* **The key for which data should be retrieved.**

**Returns**

**A reference to the data whose key is equal to** *\_\_k***, if such a data is present in the unordered\_map.**

**Exceptions**

**std::out\_of\_range If no such data is present.**

### template\<typename \_Key, typename \_Tp, typename \_Hash = hash\<\_Key\>, typename \_Pred = equal\_to\<\_Key\>, typename \_Alloc = allocator\<std::pair\<const \_Key, \_Tp\>\>\> mapped\_type & std::unordered\_map\< \_Key, \_Tp, \_Hash, \_Pred, \_Alloc \>::at (const key\_type & \_\_k) \[inline\]

**Access to unordered\_map data.**

**Parameters**

*\_\_k* **The key for which data should be retrieved.**

**Returns**

**A reference to the data whose key is equal to** *\_\_k***, if such a data is present in the unordered\_map.**

**Exceptions**

**std::out\_of\_range If no such data is present.**

### template\<typename \_Key, typename \_Tp, typename \_Hash = hash\<\_Key\>, typename \_Pred = equal\_to\<\_Key\>, typename \_Alloc = allocator\<std::pair\<const \_Key, \_Tp\>\>\> const mapped\_type & std::unordered\_map\< \_Key, \_Tp, \_Hash, \_Pred, \_Alloc \>::at (const key\_type & \_\_k) const \[inline\]

**Access to unordered\_map data.**

**Parameters**

*\_\_k* **The key for which data should be retrieved.**

**Returns**

**A reference to the data whose key is equal to** *\_\_k***, if such a data is present in the unordered\_map.**

**Exceptions**

**std::out\_of\_range If no such data is present.**

### template\<typename \_Key, typename \_Tp, typename \_Hash = hash\<\_Key\>, typename \_Pred = equal\_to\<\_Key\>, typename \_Alloc = allocator\<std::pair\<const \_Key, \_Tp\>\>\> const\_iterator std::unordered\_map\< \_Key, \_Tp, \_Hash, \_Pred, \_Alloc \>::begin () const \[inline\], \[noexcept\]

**Returns a read-only (constant) iterator that points to the first element in the unordered\_map.**

### template\<typename \_Key, typename \_Tp, typename \_Hash = hash\<\_Key\>, typename \_Pred = equal\_to\<\_Key\>, typename \_Alloc = allocator\<std::pair\<const \_Key, \_Tp\>\>\> iterator std::unordered\_map\< \_Key, \_Tp, \_Hash, \_Pred, \_Alloc \>::begin () \[inline\], \[noexcept\]

**Returns a read/write iterator that points to the first element in the unordered\_map.**

### template\<typename \_Key, typename \_Tp, typename \_Hash = hash\<\_Key\>, typename \_Pred = equal\_to\<\_Key\>, typename \_Alloc = allocator\<std::pair\<const \_Key, \_Tp\>\>\> local\_iterator std::unordered\_map\< \_Key, \_Tp, \_Hash, \_Pred, \_Alloc \>::begin (size\_type \_\_n) \[inline\]

**Returns a read/write iterator pointing to the first bucket element.**

**Parameters**

*\_\_n* **The bucket index.**

**Returns**

**A read/write local iterator.**

### template\<typename \_Key, typename \_Tp, typename \_Hash = hash\<\_Key\>, typename \_Pred = equal\_to\<\_Key\>, typename \_Alloc = allocator\<std::pair\<const \_Key, \_Tp\>\>\> const\_local\_iterator std::unordered\_map\< \_Key, \_Tp, \_Hash, \_Pred, \_Alloc \>::begin (size\_type \_\_n) const \[inline\]

**Returns a read-only (constant) iterator pointing to the first bucket element.**

**Parameters**

*\_\_n* **The bucket index.**

**Returns**

**A read-only local iterator.**

### template\<typename \_Key, typename \_Tp, typename \_Hash = hash\<\_Key\>, typename \_Pred = equal\_to\<\_Key\>, typename \_Alloc = allocator\<std::pair\<const \_Key, \_Tp\>\>\> size\_type std::unordered\_map\< \_Key, \_Tp, \_Hash, \_Pred, \_Alloc \>::bucket\_count () const \[inline\], \[noexcept\]

**Returns the number of buckets of the unordered\_map.**

### template\<typename \_Key, typename \_Tp, typename \_Hash = hash\<\_Key\>, typename \_Pred = equal\_to\<\_Key\>, typename \_Alloc = allocator\<std::pair\<const \_Key, \_Tp\>\>\> const\_iterator std::unordered\_map\< \_Key, \_Tp, \_Hash, \_Pred, \_Alloc \>::cbegin () const \[inline\], \[noexcept\]

**Returns a read-only (constant) iterator that points to the first element in the unordered\_map.**

### template\<typename \_Key, typename \_Tp, typename \_Hash = hash\<\_Key\>, typename \_Pred = equal\_to\<\_Key\>, typename \_Alloc = allocator\<std::pair\<const \_Key, \_Tp\>\>\> const\_local\_iterator std::unordered\_map\< \_Key, \_Tp, \_Hash, \_Pred, \_Alloc \>::cbegin (size\_type \_\_n) const \[inline\]

**Returns a read-only (constant) iterator pointing to the first bucket element.**

**Parameters**

*\_\_n* **The bucket index.**

**Returns**

**A read-only local iterator.**

### template\<typename \_Key, typename \_Tp, typename \_Hash = hash\<\_Key\>, typename \_Pred = equal\_to\<\_Key\>, typename \_Alloc = allocator\<std::pair\<const \_Key, \_Tp\>\>\> const\_iterator std::unordered\_map\< \_Key, \_Tp, \_Hash, \_Pred, \_Alloc \>::cend () const \[inline\], \[noexcept\]

**Returns a read-only (constant) iterator that points one past the last element in the unordered\_map.**

### template\<typename \_Key, typename \_Tp, typename \_Hash = hash\<\_Key\>, typename \_Pred = equal\_to\<\_Key\>, typename \_Alloc = allocator\<std::pair\<const \_Key, \_Tp\>\>\> const\_local\_iterator std::unordered\_map\< \_Key, \_Tp, \_Hash, \_Pred, \_Alloc \>::cend (size\_type \_\_n) const \[inline\]

**Returns a read-only (constant) iterator pointing to one past the last bucket elements.**

**Parameters**

*\_\_n* **The bucket index.**

**Returns**

**A read-only local iterator.**

### template\<typename \_Key, typename \_Tp, typename \_Hash = hash\<\_Key\>, typename \_Pred = equal\_to\<\_Key\>, typename \_Alloc = allocator\<std::pair\<const \_Key, \_Tp\>\>\> void std::unordered\_map\< \_Key, \_Tp, \_Hash, \_Pred, \_Alloc \>::clear () \[inline\], \[noexcept\]

**Erases all elements in an unordered\_map. Note that this function only erases the elements, and that if the elements themselves are pointers, the pointed-to memory is not touched in any way. Managing the pointer is the user's responsibility.**

### template\<typename \_Key, typename \_Tp, typename \_Hash = hash\<\_Key\>, typename \_Pred = equal\_to\<\_Key\>, typename \_Alloc = allocator\<std::pair\<const \_Key, \_Tp\>\>\> template\<typename \_Kt\> auto std::unordered\_map\< \_Key, \_Tp, \_Hash, \_Pred, \_Alloc \>::contains (const \_Kt & \_\_x) const -\> decltype(\_M\_h.\_M\_find\_tr(\_\_x), void(), true) \[inline\]

**Finds whether an element with the given key exists.**

**Parameters**

*\_\_x* **Key of elements to be located.**

**Returns**

**True if there is any element with the specified key.**

### template\<typename \_Key, typename \_Tp, typename \_Hash = hash\<\_Key\>, typename \_Pred = equal\_to\<\_Key\>, typename \_Alloc = allocator\<std::pair\<const \_Key, \_Tp\>\>\> bool std::unordered\_map\< \_Key, \_Tp, \_Hash, \_Pred, \_Alloc \>::contains (const key\_type & \_\_x) const \[inline\]

**Finds whether an element with the given key exists.**

**Parameters**

*\_\_x* **Key of elements to be located.**

**Returns**

**True if there is any element with the specified key.**

### template\<typename \_Key, typename \_Tp, typename \_Hash = hash\<\_Key\>, typename \_Pred = equal\_to\<\_Key\>, typename \_Alloc = allocator\<std::pair\<const \_Key, \_Tp\>\>\> size\_type std::unordered\_map\< \_Key, \_Tp, \_Hash, \_Pred, \_Alloc \>::count (const key\_type & \_\_x) const \[inline\]

**Finds the number of elements.**

**Parameters**

*\_\_x* **Key to count.**

**Returns**

**Number of elements with specified key.**

**This function only makes sense for unordered\_multimap; for unordered\_map the result will either be 0 (not present) or 1 (present).**

### template\<typename \_Key, typename \_Tp, typename \_Hash = hash\<\_Key\>, typename \_Pred = equal\_to\<\_Key\>, typename \_Alloc = allocator\<std::pair\<const \_Key, \_Tp\>\>\> template\<typename... \_Args\> std::pair\< iterator, bool \> std::unordered\_map\< \_Key, \_Tp, \_Hash, \_Pred, \_Alloc \>::emplace (\_Args &&... \_\_args) \[inline\]

**Attempts to build and insert a std::pair into the unordered\_map.**

**Parameters**

*\_\_args* **Arguments used to generate a new pair instance (see std::piecewise\_contruct for passing arguments to each part of the pair constructor).**

**Returns**

**A pair, of which the first element is an iterator that points to the possibly inserted pair, and the second is a bool that is true if the pair was actually inserted.**

**This function attempts to build and insert a (key, value) pair into the unordered\_map. An unordered\_map relies on unique keys and thus a pair is only inserted if its first element (the key) is not already present in the unordered\_map.**

**Insertion requires amortized constant time.**

### template\<typename \_Key, typename \_Tp, typename \_Hash = hash\<\_Key\>, typename \_Pred = equal\_to\<\_Key\>, typename \_Alloc = allocator\<std::pair\<const \_Key, \_Tp\>\>\> template\<typename... \_Args\> iterator std::unordered\_map\< \_Key, \_Tp, \_Hash, \_Pred, \_Alloc \>::emplace\_hint (const\_iterator \_\_pos, \_Args &&... \_\_args) \[inline\]

**Attempts to build and insert a std::pair into the unordered\_map.**

**Parameters**

*\_\_pos* **An iterator that serves as a hint as to where the pair should be inserted.** \
 *\_\_args* **Arguments used to generate a new pair instance (see std::piecewise\_contruct for passing arguments to each part of the pair constructor).**

**Returns**

**An iterator that points to the element with key of the std::pair built from** *\_\_args* **(may or may not be that std::pair).**

**This function is not concerned about whether the insertion took place, and thus does not return a boolean like the single-argument emplace() does. Note that the first parameter is only a hint and can potentially improve the performance of the insertion process. A bad hint would cause no gains in efficiency.**

**See https://gcc.gnu.org/onlinedocs/libstdc++/manual/associative.html#containers.associative.insert\_hints for more on** *hinting***.**

**Insertion requires amortized constant time.**

### template\<typename \_Key, typename \_Tp, typename \_Hash = hash\<\_Key\>, typename \_Pred = equal\_to\<\_Key\>, typename \_Alloc = allocator\<std::pair\<const \_Key, \_Tp\>\>\> bool std::unordered\_map\< \_Key, \_Tp, \_Hash, \_Pred, \_Alloc \>::empty () const \[inline\], \[nodiscard\], \[noexcept\]

**Returns true if the unordered\_map is empty.**

### template\<typename \_Key, typename \_Tp, typename \_Hash = hash\<\_Key\>, typename \_Pred = equal\_to\<\_Key\>, typename \_Alloc = allocator\<std::pair\<const \_Key, \_Tp\>\>\> const\_iterator std::unordered\_map\< \_Key, \_Tp, \_Hash, \_Pred, \_Alloc \>::end () const \[inline\], \[noexcept\]

**Returns a read-only (constant) iterator that points one past the last element in the unordered\_map.**

### template\<typename \_Key, typename \_Tp, typename \_Hash = hash\<\_Key\>, typename \_Pred = equal\_to\<\_Key\>, typename \_Alloc = allocator\<std::pair\<const \_Key, \_Tp\>\>\> iterator std::unordered\_map\< \_Key, \_Tp, \_Hash, \_Pred, \_Alloc \>::end () \[inline\], \[noexcept\]

**Returns a read/write iterator that points one past the last element in the unordered\_map.**

### template\<typename \_Key, typename \_Tp, typename \_Hash = hash\<\_Key\>, typename \_Pred = equal\_to\<\_Key\>, typename \_Alloc = allocator\<std::pair\<const \_Key, \_Tp\>\>\> local\_iterator std::unordered\_map\< \_Key, \_Tp, \_Hash, \_Pred, \_Alloc \>::end (size\_type \_\_n) \[inline\]

**Returns a read/write iterator pointing to one past the last bucket elements.**

**Parameters**

*\_\_n* **The bucket index.**

**Returns**

**A read/write local iterator.**

### template\<typename \_Key, typename \_Tp, typename \_Hash = hash\<\_Key\>, typename \_Pred = equal\_to\<\_Key\>, typename \_Alloc = allocator\<std::pair\<const \_Key, \_Tp\>\>\> const\_local\_iterator std::unordered\_map\< \_Key, \_Tp, \_Hash, \_Pred, \_Alloc \>::end (size\_type \_\_n) const \[inline\]

**Returns a read-only (constant) iterator pointing to one past the last bucket elements.**

**Parameters**

*\_\_n* **The bucket index.**

**Returns**

**A read-only local iterator.**

### template\<typename \_Key, typename \_Tp, typename \_Hash = hash\<\_Key\>, typename \_Pred = equal\_to\<\_Key\>, typename \_Alloc = allocator\<std::pair\<const \_Key, \_Tp\>\>\> std::pair\< iterator, iterator \> std::unordered\_map\< \_Key, \_Tp, \_Hash, \_Pred, \_Alloc \>::equal\_range (const key\_type & \_\_x) \[inline\]

**Finds a subsequence matching given key.**

**Parameters**

*\_\_x* **Key to be located.**

**Returns**

**Pair of iterators that possibly points to the subsequence matching given key.**

**This function probably only makes sense for unordered\_multimap.**

### template\<typename \_Key, typename \_Tp, typename \_Hash = hash\<\_Key\>, typename \_Pred = equal\_to\<\_Key\>, typename \_Alloc = allocator\<std::pair\<const \_Key, \_Tp\>\>\> std::pair\< const\_iterator, const\_iterator \> std::unordered\_map\< \_Key, \_Tp, \_Hash, \_Pred, \_Alloc \>::equal\_range (const key\_type & \_\_x) const \[inline\]

**Finds a subsequence matching given key.**

**Parameters**

*\_\_x* **Key to be located.**

**Returns**

**Pair of iterators that possibly points to the subsequence matching given key.**

**This function probably only makes sense for unordered\_multimap.**

### template\<typename \_Key, typename \_Tp, typename \_Hash = hash\<\_Key\>, typename \_Pred = equal\_to\<\_Key\>, typename \_Alloc = allocator\<std::pair\<const \_Key, \_Tp\>\>\> template\<\_\_heterogeneous\_hash\_key\< unordered\_map \> \_Kt\> size\_type std::unordered\_map\< \_Key, \_Tp, \_Hash, \_Pred, \_Alloc \>::erase (\_Kt && \_\_x) \[inline\]

**Erases elements according to the provided key.**

**Parameters**

*\_\_x* **Key of element to be erased.**

**Returns**

**The number of elements erased.**

**This function erases all the elements located by the given key from an unordered\_map. For an unordered\_map the result of this function can only be 0 (not present) or 1 (present). Note that this function only erases the element, and that if the element is itself a pointer, the pointed-to memory is not touched in any way. Managing the pointer is the user's responsibility.**

### template\<typename \_Key, typename \_Tp, typename \_Hash = hash\<\_Key\>, typename \_Pred = equal\_to\<\_Key\>, typename \_Alloc = allocator\<std::pair\<const \_Key, \_Tp\>\>\> size\_type std::unordered\_map\< \_Key, \_Tp, \_Hash, \_Pred, \_Alloc \>::erase (const key\_type & \_\_x) \[inline\]

**Erases elements according to the provided key.**

**Parameters**

*\_\_x* **Key of element to be erased.**

**Returns**

**The number of elements erased.**

**This function erases all the elements located by the given key from an unordered\_map. For an unordered\_map the result of this function can only be 0 (not present) or 1 (present). Note that this function only erases the element, and that if the element is itself a pointer, the pointed-to memory is not touched in any way. Managing the pointer is the user's responsibility.**

### template\<typename \_Key, typename \_Tp, typename \_Hash = hash\<\_Key\>, typename \_Pred = equal\_to\<\_Key\>, typename \_Alloc = allocator\<std::pair\<const \_Key, \_Tp\>\>\> iterator std::unordered\_map\< \_Key, \_Tp, \_Hash, \_Pred, \_Alloc \>::erase (const\_iterator \_\_first, const\_iterator \_\_last) \[inline\]

**Erases a \[\_\_first,\_\_last) range of elements from an unordered\_map.**

**Parameters**

*\_\_first* **Iterator pointing to the start of the range to be erased.** \
 *\_\_last* **Iterator pointing to the end of the range to be erased.**

**Returns**

**The iterator** *\_\_last***.**

**This function erases a sequence of elements from an unordered\_map. Note that this function only erases the elements, and that if the element is itself a pointer, the pointed-to memory is not touched in any way. Managing the pointer is the user's responsibility.**

### template\<typename \_Key, typename \_Tp, typename \_Hash = hash\<\_Key\>, typename \_Pred = equal\_to\<\_Key\>, typename \_Alloc = allocator\<std::pair\<const \_Key, \_Tp\>\>\> iterator std::unordered\_map\< \_Key, \_Tp, \_Hash, \_Pred, \_Alloc \>::erase (const\_iterator \_\_position) \[inline\]

**Erases an element from an unordered\_map.**

**Parameters**

*\_\_position* **An iterator pointing to the element to be erased.**

**Returns**

**An iterator pointing to the element immediately following** *\_\_position* **prior to the element being erased. If no such element exists, end() is returned.**

**This function erases an element, pointed to by the given iterator, from an unordered\_map. Note that this function only erases the element, and that if the element is itself a pointer, the pointed-to memory is not touched in any way. Managing the pointer is the user's responsibility.**

### template\<typename \_Key, typename \_Tp, typename \_Hash = hash\<\_Key\>, typename \_Pred = equal\_to\<\_Key\>, typename \_Alloc = allocator\<std::pair\<const \_Key, \_Tp\>\>\> iterator std::unordered\_map\< \_Key, \_Tp, \_Hash, \_Pred, \_Alloc \>::erase (iterator \_\_position) \[inline\]

**Erases an element from an unordered\_map.**

**Parameters**

*\_\_position* **An iterator pointing to the element to be erased.**

**Returns**

**An iterator pointing to the element immediately following** *\_\_position* **prior to the element being erased. If no such element exists, end() is returned.**

**This function erases an element, pointed to by the given iterator, from an unordered\_map. Note that this function only erases the element, and that if the element is itself a pointer, the pointed-to memory is not touched in any way. Managing the pointer is the user's responsibility.**

### template\<typename \_Key, typename \_Tp, typename \_Hash = hash\<\_Key\>, typename \_Pred = equal\_to\<\_Key\>, typename \_Alloc = allocator\<std::pair\<const \_Key, \_Tp\>\>\> iterator std::unordered\_map\< \_Key, \_Tp, \_Hash, \_Pred, \_Alloc \>::find (const key\_type & \_\_x) \[inline\]

**Tries to locate an element in an unordered\_map.**

**Parameters**

*\_\_x* **Key to be located.**

**Returns**

**Iterator pointing to sought-after element, or end() if not found.**

**This function takes a key and tries to locate the element with which the key matches. If successful the function returns an iterator pointing to the sought after element. If unsuccessful it returns the past-the-end (** end() **) iterator.**

### template\<typename \_Key, typename \_Tp, typename \_Hash = hash\<\_Key\>, typename \_Pred = equal\_to\<\_Key\>, typename \_Alloc = allocator\<std::pair\<const \_Key, \_Tp\>\>\> const\_iterator std::unordered\_map\< \_Key, \_Tp, \_Hash, \_Pred, \_Alloc \>::find (const key\_type & \_\_x) const \[inline\]

**Tries to locate an element in an unordered\_map.**

**Parameters**

*\_\_x* **Key to be located.**

**Returns**

**Iterator pointing to sought-after element, or end() if not found.**

**This function takes a key and tries to locate the element with which the key matches. If successful the function returns an iterator pointing to the sought after element. If unsuccessful it returns the past-the-end (** end() **) iterator.**

### template\<typename \_Key, typename \_Tp, typename \_Hash = hash\<\_Key\>, typename \_Pred = equal\_to\<\_Key\>, typename \_Alloc = allocator\<std::pair\<const \_Key, \_Tp\>\>\> allocator\_type std::unordered\_map\< \_Key, \_Tp, \_Hash, \_Pred, \_Alloc \>::get\_allocator () const \[inline\], \[noexcept\]

**Returns the allocator object used by the unordered\_map.**

### template\<typename \_Key, typename \_Tp, typename \_Hash = hash\<\_Key\>, typename \_Pred = equal\_to\<\_Key\>, typename \_Alloc = allocator\<std::pair\<const \_Key, \_Tp\>\>\> hasher std::unordered\_map\< \_Key, \_Tp, \_Hash, \_Pred, \_Alloc \>::hash\_function () const \[inline\]

**Returns the hash functor object with which the unordered\_map was constructed.**

### template\<typename \_Key, typename \_Tp, typename \_Hash = hash\<\_Key\>, typename \_Pred = equal\_to\<\_Key\>, typename \_Alloc = allocator\<std::pair\<const \_Key, \_Tp\>\>\> template\<typename \_InputIterator\> void std::unordered\_map\< \_Key, \_Tp, \_Hash, \_Pred, \_Alloc \>::insert (\_InputIterator \_\_first, \_InputIterator \_\_last) \[inline\]

**A template function that attempts to insert a range of elements.**

**Parameters**

*\_\_first* **Iterator pointing to the start of the range to be inserted.** \
 *\_\_last* **Iterator pointing to the end of the range.**

**Complexity similar to that of the range constructor.**

### template\<typename \_Key, typename \_Tp, typename \_Hash = hash\<\_Key\>, typename \_Pred = equal\_to\<\_Key\>, typename \_Alloc = allocator\<std::pair\<const \_Key, \_Tp\>\>\> template\<typename \_Pair\> \_\_enable\_if\_t\< is\_constructible\< value\_type, \_Pair && \>::value, pair\< iterator, bool \> \> std::unordered\_map\< \_Key, \_Tp, \_Hash, \_Pred, \_Alloc \>::insert (\_Pair && \_\_x) \[inline\]

**Attempts to insert a std::pair into the unordered\_map.**

**Parameters**

*\_\_x* **Pair to be inserted (see std::make\_pair for easy creation of pairs).**

**Returns**

**A pair, of which the first element is an iterator that points to the possibly inserted pair, and the second is a bool that is true if the pair was actually inserted.**

**This function attempts to insert a (key, value) pair into the unordered\_map. An unordered\_map relies on unique keys and thus a pair is only inserted if its first element (the key) is not already present in the unordered\_map.**

**Insertion requires amortized constant time.**

### template\<typename \_Key, typename \_Tp, typename \_Hash = hash\<\_Key\>, typename \_Pred = equal\_to\<\_Key\>, typename \_Alloc = allocator\<std::pair\<const \_Key, \_Tp\>\>\> std::pair\< iterator, bool \> std::unordered\_map\< \_Key, \_Tp, \_Hash, \_Pred, \_Alloc \>::insert (const value\_type & \_\_x) \[inline\]

**Attempts to insert a std::pair into the unordered\_map.**

**Parameters**

*\_\_x* **Pair to be inserted (see std::make\_pair for easy creation of pairs).**

**Returns**

**A pair, of which the first element is an iterator that points to the possibly inserted pair, and the second is a bool that is true if the pair was actually inserted.**

**This function attempts to insert a (key, value) pair into the unordered\_map. An unordered\_map relies on unique keys and thus a pair is only inserted if its first element (the key) is not already present in the unordered\_map.**

**Insertion requires amortized constant time.**

### template\<typename \_Key, typename \_Tp, typename \_Hash = hash\<\_Key\>, typename \_Pred = equal\_to\<\_Key\>, typename \_Alloc = allocator\<std::pair\<const \_Key, \_Tp\>\>\> template\<typename \_Pair\> \_\_enable\_if\_t\< is\_constructible\< value\_type, \_Pair && \>::value, iterator \> std::unordered\_map\< \_Key, \_Tp, \_Hash, \_Pred, \_Alloc \>::insert (const\_iterator \_\_hint, \_Pair && \_\_x) \[inline\]

**Attempts to insert a std::pair into the unordered\_map.**

**Parameters**

*\_\_hint* **An iterator that serves as a hint as to where the pair should be inserted.** \
 *\_\_x* **Pair to be inserted (see std::make\_pair for easy creation of pairs).**

**Returns**

**An iterator that points to the element with key of** *\_\_x* **(may or may not be the pair passed in).**

**This function is not concerned about whether the insertion took place, and thus does not return a boolean like the single-argument insert() does. Note that the first parameter is only a hint and can potentially improve the performance of the insertion process. A bad hint would cause no gains in efficiency.**

**See https://gcc.gnu.org/onlinedocs/libstdc++/manual/associative.html#containers.associative.insert\_hints for more on** *hinting***.**

**Insertion requires amortized constant time.**

### template\<typename \_Key, typename \_Tp, typename \_Hash = hash\<\_Key\>, typename \_Pred = equal\_to\<\_Key\>, typename \_Alloc = allocator\<std::pair\<const \_Key, \_Tp\>\>\> iterator std::unordered\_map\< \_Key, \_Tp, \_Hash, \_Pred, \_Alloc \>::insert (const\_iterator \_\_hint, const value\_type & \_\_x) \[inline\]

**Attempts to insert a std::pair into the unordered\_map.**

**Parameters**

*\_\_hint* **An iterator that serves as a hint as to where the pair should be inserted.** \
 *\_\_x* **Pair to be inserted (see std::make\_pair for easy creation of pairs).**

**Returns**

**An iterator that points to the element with key of** *\_\_x* **(may or may not be the pair passed in).**

**This function is not concerned about whether the insertion took place, and thus does not return a boolean like the single-argument insert() does. Note that the first parameter is only a hint and can potentially improve the performance of the insertion process. A bad hint would cause no gains in efficiency.**

**See https://gcc.gnu.org/onlinedocs/libstdc++/manual/associative.html#containers.associative.insert\_hints for more on** *hinting***.**

**Insertion requires amortized constant time.**

### template\<typename \_Key, typename \_Tp, typename \_Hash = hash\<\_Key\>, typename \_Pred = equal\_to\<\_Key\>, typename \_Alloc = allocator\<std::pair\<const \_Key, \_Tp\>\>\> iterator std::unordered\_map\< \_Key, \_Tp, \_Hash, \_Pred, \_Alloc \>::insert (const\_iterator \_\_hint, value\_type && \_\_x) \[inline\]

**Attempts to insert a std::pair into the unordered\_map.**

**Parameters**

*\_\_hint* **An iterator that serves as a hint as to where the pair should be inserted.** \
 *\_\_x* **Pair to be inserted (see std::make\_pair for easy creation of pairs).**

**Returns**

**An iterator that points to the element with key of** *\_\_x* **(may or may not be the pair passed in).**

**This function is not concerned about whether the insertion took place, and thus does not return a boolean like the single-argument insert() does. Note that the first parameter is only a hint and can potentially improve the performance of the insertion process. A bad hint would cause no gains in efficiency.**

**See https://gcc.gnu.org/onlinedocs/libstdc++/manual/associative.html#containers.associative.insert\_hints for more on** *hinting***.**

**Insertion requires amortized constant time.**

### template\<typename \_Key, typename \_Tp, typename \_Hash = hash\<\_Key\>, typename \_Pred = equal\_to\<\_Key\>, typename \_Alloc = allocator\<std::pair\<const \_Key, \_Tp\>\>\> void std::unordered\_map\< \_Key, \_Tp, \_Hash, \_Pred, \_Alloc \>::insert (initializer\_list\< value\_type \> \_\_l) \[inline\]

**Attempts to insert a list of elements into the unordered\_map.**

**Parameters**

*\_\_l* **A std::initializer\_list\<value\_type\> of elements to be inserted.**

**Complexity similar to that of the range constructor.**

### template\<typename \_Key, typename \_Tp, typename \_Hash = hash\<\_Key\>, typename \_Pred = equal\_to\<\_Key\>, typename \_Alloc = allocator\<std::pair\<const \_Key, \_Tp\>\>\> std::pair\< iterator, bool \> std::unordered\_map\< \_Key, \_Tp, \_Hash, \_Pred, \_Alloc \>::insert (value\_type && \_\_x) \[inline\]

**Attempts to insert a std::pair into the unordered\_map.**

**Parameters**

*\_\_x* **Pair to be inserted (see std::make\_pair for easy creation of pairs).**

**Returns**

**A pair, of which the first element is an iterator that points to the possibly inserted pair, and the second is a bool that is true if the pair was actually inserted.**

**This function attempts to insert a (key, value) pair into the unordered\_map. An unordered\_map relies on unique keys and thus a pair is only inserted if its first element (the key) is not already present in the unordered\_map.**

**Insertion requires amortized constant time.**

### template\<typename \_Key, typename \_Tp, typename \_Hash = hash\<\_Key\>, typename \_Pred = equal\_to\<\_Key\>, typename \_Alloc = allocator\<std::pair\<const \_Key, \_Tp\>\>\> key\_equal std::unordered\_map\< \_Key, \_Tp, \_Hash, \_Pred, \_Alloc \>::key\_eq () const \[inline\]

**Returns the key comparison object with which the unordered\_map was constructed.**

### template\<typename \_Key, typename \_Tp, typename \_Hash = hash\<\_Key\>, typename \_Pred = equal\_to\<\_Key\>, typename \_Alloc = allocator\<std::pair\<const \_Key, \_Tp\>\>\> float std::unordered\_map\< \_Key, \_Tp, \_Hash, \_Pred, \_Alloc \>::load\_factor () const \[inline\], \[noexcept\]

**Returns the average number of elements per bucket.**

### template\<typename \_Key, typename \_Tp, typename \_Hash = hash\<\_Key\>, typename \_Pred = equal\_to\<\_Key\>, typename \_Alloc = allocator\<std::pair\<const \_Key, \_Tp\>\>\> size\_type std::unordered\_map\< \_Key, \_Tp, \_Hash, \_Pred, \_Alloc \>::max\_bucket\_count () const \[inline\], \[noexcept\]

**Returns the maximum number of buckets of the unordered\_map.**

### template\<typename \_Key, typename \_Tp, typename \_Hash = hash\<\_Key\>, typename \_Pred = equal\_to\<\_Key\>, typename \_Alloc = allocator\<std::pair\<const \_Key, \_Tp\>\>\> float std::unordered\_map\< \_Key, \_Tp, \_Hash, \_Pred, \_Alloc \>::max\_load\_factor () const \[inline\], \[noexcept\]

**Returns a positive number that the unordered\_map tries to keep the load factor less than or equal to.**

### template\<typename \_Key, typename \_Tp, typename \_Hash = hash\<\_Key\>, typename \_Pred = equal\_to\<\_Key\>, typename \_Alloc = allocator\<std::pair\<const \_Key, \_Tp\>\>\> void std::unordered\_map\< \_Key, \_Tp, \_Hash, \_Pred, \_Alloc \>::max\_load\_factor (float \_\_z) \[inline\]

**Change the unordered\_map maximum load factor.**

**Parameters**

*\_\_z* **The new maximum load factor.**

### template\<typename \_Key, typename \_Tp, typename \_Hash = hash\<\_Key\>, typename \_Pred = equal\_to\<\_Key\>, typename \_Alloc = allocator\<std::pair\<const \_Key, \_Tp\>\>\> size\_type std::unordered\_map\< \_Key, \_Tp, \_Hash, \_Pred, \_Alloc \>::max\_size () const \[inline\], \[noexcept\]

**Returns the maximum size of the unordered\_map.**

### template\<typename \_Key, typename \_Tp, typename \_Hash = hash\<\_Key\>, typename \_Pred = equal\_to\<\_Key\>, typename \_Alloc = allocator\<std::pair\<const \_Key, \_Tp\>\>\> unordered\_map & std::unordered\_map\< \_Key, \_Tp, \_Hash, \_Pred, \_Alloc \>::operator= (const unordered\_map\< \_Key, \_Tp, \_Hash, \_Pred, \_Alloc \> & ) \[default\]

**Copy assignment operator.**

### template\<typename \_Key, typename \_Tp, typename \_Hash = hash\<\_Key\>, typename \_Pred = equal\_to\<\_Key\>, typename \_Alloc = allocator\<std::pair\<const \_Key, \_Tp\>\>\> unordered\_map & std::unordered\_map\< \_Key, \_Tp, \_Hash, \_Pred, \_Alloc \>::operator= (initializer\_list\< value\_type \> \_\_l) \[inline\]

**Unordered\_map list assignment operator.**

**Parameters**

*\_\_l* **An initializer\_list.**

**This function fills an unordered\_map with copies of the elements in the initializer list** *\_\_l***.**

**Note that the assignment completely changes the unordered\_map and that the resulting unordered\_map's size is the same as the number of elements assigned.**

### template\<typename \_Key, typename \_Tp, typename \_Hash = hash\<\_Key\>, typename \_Pred = equal\_to\<\_Key\>, typename \_Alloc = allocator\<std::pair\<const \_Key, \_Tp\>\>\> unordered\_map & std::unordered\_map\< \_Key, \_Tp, \_Hash, \_Pred, \_Alloc \>::operator= (unordered\_map\< \_Key, \_Tp, \_Hash, \_Pred, \_Alloc \> && ) \[default\]

**Move assignment operator.**

### template\<typename \_Key, typename \_Tp, typename \_Hash = hash\<\_Key\>, typename \_Pred = equal\_to\<\_Key\>, typename \_Alloc = allocator\<std::pair\<const \_Key, \_Tp\>\>\> template\<\_\_heterogeneous\_hash\_key\< unordered\_map \> \_Kt\> mapped\_type & std::unordered\_map\< \_Key, \_Tp, \_Hash, \_Pred, \_Alloc \>::operator\[\] (\_Kt && \_\_k) \[inline\]

**Subscript ( \[\] ) access to unordered\_map data.**

**Parameters**

*\_\_k* **The key for which data should be retrieved.**

**Returns**

**A reference to the data of the (key,data) pair.**

**Allows for easy lookup with the subscript ( \[\] )operator. Returns data associated with the key specified in subscript. If the key does not exist, a pair with that key is created using default values, which is then returned.**

**Lookup requires constant time.**

### template\<typename \_Key, typename \_Tp, typename \_Hash = hash\<\_Key\>, typename \_Pred = equal\_to\<\_Key\>, typename \_Alloc = allocator\<std::pair\<const \_Key, \_Tp\>\>\> mapped\_type & std::unordered\_map\< \_Key, \_Tp, \_Hash, \_Pred, \_Alloc \>::operator\[\] (const key\_type & \_\_k) \[inline\]

**Subscript ( \[\] ) access to unordered\_map data.**

**Parameters**

*\_\_k* **The key for which data should be retrieved.**

**Returns**

**A reference to the data of the (key,data) pair.**

**Allows for easy lookup with the subscript ( \[\] )operator. Returns data associated with the key specified in subscript. If the key does not exist, a pair with that key is created using default values, which is then returned.**

**Lookup requires constant time.**

### template\<typename \_Key, typename \_Tp, typename \_Hash = hash\<\_Key\>, typename \_Pred = equal\_to\<\_Key\>, typename \_Alloc = allocator\<std::pair\<const \_Key, \_Tp\>\>\> mapped\_type & std::unordered\_map\< \_Key, \_Tp, \_Hash, \_Pred, \_Alloc \>::operator\[\] (key\_type && \_\_k) \[inline\]

**Subscript ( \[\] ) access to unordered\_map data.**

**Parameters**

*\_\_k* **The key for which data should be retrieved.**

**Returns**

**A reference to the data of the (key,data) pair.**

**Allows for easy lookup with the subscript ( \[\] )operator. Returns data associated with the key specified in subscript. If the key does not exist, a pair with that key is created using default values, which is then returned.**

**Lookup requires constant time.**

### template\<typename \_Key, typename \_Tp, typename \_Hash = hash\<\_Key\>, typename \_Pred = equal\_to\<\_Key\>, typename \_Alloc = allocator\<std::pair\<const \_Key, \_Tp\>\>\> void std::unordered\_map\< \_Key, \_Tp, \_Hash, \_Pred, \_Alloc \>::rehash (size\_type \_\_n) \[inline\]

**May rehash the unordered\_map.**

**Parameters**

*\_\_n* **The new number of buckets.**

**Rehash will occur only if the new number of buckets respect the unordered\_map maximum load factor.**

### template\<typename \_Key, typename \_Tp, typename \_Hash = hash\<\_Key\>, typename \_Pred = equal\_to\<\_Key\>, typename \_Alloc = allocator\<std::pair\<const \_Key, \_Tp\>\>\> void std::unordered\_map\< \_Key, \_Tp, \_Hash, \_Pred, \_Alloc \>::reserve (size\_type \_\_n) \[inline\]

**Prepare the unordered\_map for a specified number of elements.**

**Parameters**

*\_\_n* **Number of elements required.**

**Same as rehash(ceil(n / max\_load\_factor())).**

### template\<typename \_Key, typename \_Tp, typename \_Hash = hash\<\_Key\>, typename \_Pred = equal\_to\<\_Key\>, typename \_Alloc = allocator\<std::pair\<const \_Key, \_Tp\>\>\> size\_type std::unordered\_map\< \_Key, \_Tp, \_Hash, \_Pred, \_Alloc \>::size () const \[inline\], \[noexcept\]

**Returns the size of the unordered\_map.**

### template\<typename \_Key, typename \_Tp, typename \_Hash = hash\<\_Key\>, typename \_Pred = equal\_to\<\_Key\>, typename \_Alloc = allocator\<std::pair\<const \_Key, \_Tp\>\>\> void std::unordered\_map\< \_Key, \_Tp, \_Hash, \_Pred, \_Alloc \>::swap (unordered\_map\< \_Key, \_Tp, \_Hash, \_Pred, \_Alloc \> & \_\_x) \[inline\], \[noexcept\]

**Swaps data with another unordered\_map.**

**Parameters**

*\_\_x* **An unordered\_map of the same element and allocator types.**

**This exchanges the elements between two unordered\_map in constant time. Note that the global std::swap() function is specialized such that std::swap(m1,m2) will feed to this function.**

## Author

**Generated automatically by Doxygen for libstdc++ from the source code.**
