78 lines
2.9 KiB
Markdown
78 lines
2.9 KiB
Markdown
[unord.map.cnstr]
|
||
|
||
# 23 Containers library [[containers]](./#containers)
|
||
|
||
## 23.5 Unordered associative containers [[unord]](unord#map.cnstr)
|
||
|
||
### 23.5.3 Class template unordered_map [[unord.map]](unord.map#cnstr)
|
||
|
||
#### 23.5.3.2 Constructors [unord.map.cnstr]
|
||
|
||
[ð](#lib:unordered_map,constructor)
|
||
|
||
`constexpr unordered_map() : unordered_map(size_type(see below)) { }
|
||
constexpr explicit unordered_map(size_type n, const hasher& hf = hasher(),
|
||
const key_equal& eql = key_equal(),
|
||
const allocator_type& a = allocator_type());
|
||
`
|
||
|
||
[1](#1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L13745)
|
||
|
||
*Effects*: Constructs an empty unordered_map using the
|
||
specified hash function, key equality predicate, and allocator, and
|
||
using at least n buckets[.](#1.sentence-1)
|
||
|
||
For the default constructor,
|
||
the number of buckets is implementation-defined[.](#1.sentence-2)
|
||
|
||
max_load_factor() returns 1.0[.](#1.sentence-3)
|
||
|
||
[2](#2)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L13754)
|
||
|
||
*Complexity*: Constant[.](#2.sentence-1)
|
||
|
||
[ð](#lib:unordered_map,constructor_)
|
||
|
||
`template<class InputIterator>
|
||
constexpr unordered_map(InputIterator f, InputIterator l,
|
||
size_type n = see below, const hasher& hf = hasher(),
|
||
const key_equal& eql = key_equal(),
|
||
const allocator_type& a = allocator_type());
|
||
template<[container-compatible-range](container.intro.reqmts#concept:container-compatible-range "23.2.2.1 Introduction [container.intro.reqmts]")<value_type> R>
|
||
constexpr unordered_map(from_range_t, R&& rg,
|
||
size_type n = see below, const hasher& hf = hasher(),
|
||
const key_equal& eql = key_equal(),
|
||
const allocator_type& a = allocator_type());
|
||
constexpr unordered_map(initializer_list<value_type> il,
|
||
size_type n = see below, const hasher& hf = hasher(),
|
||
const key_equal& eql = key_equal(),
|
||
const allocator_type& a = allocator_type());
|
||
`
|
||
|
||
[3](#3)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L13778)
|
||
|
||
*Effects*: Constructs an empty unordered_map using the
|
||
specified hash function, key equality predicate, and allocator, and
|
||
using at least n buckets[.](#3.sentence-1)
|
||
|
||
If n is not
|
||
provided, the number of buckets is implementation-defined[.](#3.sentence-2)
|
||
|
||
Then
|
||
inserts elements from the range [f, l), rg, or il,
|
||
respectively[.](#3.sentence-3)
|
||
|
||
max_load_factor() returns 1.0[.](#3.sentence-4)
|
||
|
||
[4](#4)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L13789)
|
||
|
||
*Complexity*: Average case linear, worst case quadratic[.](#4.sentence-1)
|