Init
This commit is contained in:
23
cppdraft/unord/general.md
Normal file
23
cppdraft/unord/general.md
Normal file
@@ -0,0 +1,23 @@
|
||||
[unord.general]
|
||||
|
||||
# 23 Containers library [[containers]](./#containers)
|
||||
|
||||
## 23.5 Unordered associative containers [[unord]](unord#general)
|
||||
|
||||
### 23.5.1 General [unord.general]
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L13314)
|
||||
|
||||
The header [<unordered_map>](unord.map.syn#header:%3cunordered_map%3e "23.5.2 Header <unordered_map> synopsis [unord.map.syn]") defines the class
|
||||
templates unordered_map and unordered_multimap;
|
||||
the header [<unordered_set>](unord.set.syn#header:%3cunordered_set%3e "23.5.5 Header <unordered_set> synopsis [unord.set.syn]") defines the class
|
||||
templates unordered_set and unordered_multiset[.](#1.sentence-1)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L13320)
|
||||
|
||||
The exposition-only alias templates*iter-value-type*, *iter-key-type*,*iter-mapped-type*, *iter-to-alloc-type*,*range-key-type*, *range-mapped-type*,
|
||||
and *range-to-alloc-type* defined in [[associative.general]](associative.general "23.4.1 General") may appear in deduction guides for unordered containers[.](#2.sentence-1)
|
||||
83
cppdraft/unord/hash.md
Normal file
83
cppdraft/unord/hash.md
Normal file
@@ -0,0 +1,83 @@
|
||||
[unord.hash]
|
||||
|
||||
# 22 General utilities library [[utilities]](./#utilities)
|
||||
|
||||
## 22.10 Function objects [[function.objects]](function.objects#unord.hash)
|
||||
|
||||
### 22.10.19 Class template hash [unord.hash]
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L15566)
|
||||
|
||||
The unordered associative containers defined in [[unord]](unord "23.5 Unordered associative containers") use
|
||||
specializations of the class template hash ([[functional.syn]](functional.syn "22.10.2 Header <functional> synopsis"))
|
||||
as the default hash function[.](#1.sentence-1)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L15573)
|
||||
|
||||
Each specialization of hash is either enabled or disabled,
|
||||
as described below[.](#2.sentence-1)
|
||||
|
||||
[*Note [1](#note-1)*:
|
||||
|
||||
Enabled specializations meet the [*Cpp17Hash*](hash.requirements#:Cpp17Hash "16.4.4.5 Cpp17Hash requirements [hash.requirements]") requirements, and
|
||||
disabled specializations do not[.](#2.sentence-2)
|
||||
|
||||
â *end note*]
|
||||
|
||||
Each header that declares the template hash provides enabled specializations of hash for nullptr_t and
|
||||
all cv-unqualified arithmetic, enumeration, and pointer types[.](#2.sentence-3)
|
||||
|
||||
For any type Key for which neither the library nor the user provides
|
||||
an explicit or partial specialization of the class template hash,hash<Key> is disabled[.](#2.sentence-4)
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L15587)
|
||||
|
||||
If the library provides an explicit or partial specialization of hash<Key>,
|
||||
that specialization is enabled except as noted otherwise,
|
||||
and its member functions are noexcept except as noted otherwise[.](#3.sentence-1)
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L15592)
|
||||
|
||||
If H is a disabled specialization of hash,
|
||||
these values are false:is_default_constructible_v<H>,is_copy_constructible_v<H>,is_move_constructible_v<H>,is_copy_assignable_v<H>, andis_move_assignable_v<H>[.](#4.sentence-1)
|
||||
|
||||
Disabled specializations of hash are not function object types ([[function.objects]](function.objects "22.10 Function objects"))[.](#4.sentence-2)
|
||||
|
||||
[*Note [2](#note-2)*:
|
||||
|
||||
This means that the specialization of hash exists, but
|
||||
any attempts to use it as a [*Cpp17Hash*](hash.requirements#:Cpp17Hash "16.4.4.5 Cpp17Hash requirements [hash.requirements]") will be ill-formed[.](#4.sentence-3)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[5](#5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L15607)
|
||||
|
||||
An enabled specialization hash<Key> will:
|
||||
|
||||
- [(5.1)](#5.1)
|
||||
|
||||
meet the [*Cpp17Hash*](hash.requirements#:Cpp17Hash "16.4.4.5 Cpp17Hash requirements [hash.requirements]") requirements (Table [37](hash.requirements#tab:cpp17.hash "Table 37: Cpp17Hash requirements")),
|
||||
with Key as the function
|
||||
call argument type, the [*Cpp17DefaultConstructible*](utility.arg.requirements#:Cpp17DefaultConstructible "16.4.4.2 Template argument requirements [utility.arg.requirements]") requirements (Table [30](utility.arg.requirements#tab:cpp17.defaultconstructible "Table 30: Cpp17DefaultConstructible requirements")),
|
||||
the [*Cpp17CopyAssignable*](utility.arg.requirements#:Cpp17CopyAssignable "16.4.4.2 Template argument requirements [utility.arg.requirements]") requirements (Table [34](utility.arg.requirements#tab:cpp17.copyassignable "Table 34: Cpp17CopyAssignable requirements (in addition to Cpp17MoveAssignable)")),
|
||||
the [*Cpp17Swappable*](swappable.requirements#:Cpp17Swappable "16.4.4.3 Swappable requirements [swappable.requirements]") requirements ([[swappable.requirements]](swappable.requirements "16.4.4.3 Swappable requirements")),
|
||||
|
||||
- [(5.2)](#5.2)
|
||||
|
||||
meet the requirement that if k1 == k2 is true, h(k1) == h(k2) is
|
||||
also true, where h is an object of type hash<Key> and k1 and k2 are objects of type Key;
|
||||
|
||||
- [(5.3)](#5.3)
|
||||
|
||||
meet the requirement that the expression h(k), where h is an object of type hash<Key> and k is an object of typeKey, shall not throw an exception unless hash<Key> is a
|
||||
program-defined specialization[.](#5.sentence-1)
|
||||
582
cppdraft/unord/map.md
Normal file
582
cppdraft/unord/map.md
Normal file
File diff suppressed because one or more lines are too long
77
cppdraft/unord/map/cnstr.md
Normal file
77
cppdraft/unord/map/cnstr.md
Normal file
@@ -0,0 +1,77 @@
|
||||
[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)
|
||||
96
cppdraft/unord/map/elem.md
Normal file
96
cppdraft/unord/map/elem.md
Normal file
@@ -0,0 +1,96 @@
|
||||
[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)
|
||||
22
cppdraft/unord/map/erasure.md
Normal file
22
cppdraft/unord/map/erasure.md
Normal file
@@ -0,0 +1,22 @@
|
||||
[unord.map.erasure]
|
||||
|
||||
# 23 Containers library [[containers]](./#containers)
|
||||
|
||||
## 23.5 Unordered associative containers [[unord]](unord#map.erasure)
|
||||
|
||||
### 23.5.3 Class template unordered_map [[unord.map]](unord.map#erasure)
|
||||
|
||||
#### 23.5.3.5 Erasure [unord.map.erasure]
|
||||
|
||||
[ð](#lib:erase_if,unordered_map)
|
||||
|
||||
`template<class K, class T, class H, class P, class A, class Predicate>
|
||||
constexpr typename unordered_map<K, T, H, P, A>::size_type
|
||||
erase_if(unordered_map<K, T, H, P, A>& c, Predicate pred);
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L14181)
|
||||
|
||||
*Effects*: Equivalent to:auto original_size = c.size();for (auto i = c.begin(), last = c.end(); i != last; ) {if (pred(*i)) { i = c.erase(i); } else {++i; }}return original_size - c.size();
|
||||
337
cppdraft/unord/map/modifiers.md
Normal file
337
cppdraft/unord/map/modifiers.md
Normal file
@@ -0,0 +1,337 @@
|
||||
[unord.map.modifiers]
|
||||
|
||||
# 23 Containers library [[containers]](./#containers)
|
||||
|
||||
## 23.5 Unordered associative containers [[unord]](unord#map.modifiers)
|
||||
|
||||
### 23.5.3 Class template unordered_map [[unord.map]](unord.map#modifiers)
|
||||
|
||||
#### 23.5.3.4 Modifiers [unord.map.modifiers]
|
||||
|
||||
[ð](#lib:unordered_map,insert)
|
||||
|
||||
`template<class P>
|
||||
constexpr pair<iterator, bool> insert(P&& obj);
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L13891)
|
||||
|
||||
*Constraints*: is_constructible_v<value_type, P&&> is true[.](#1.sentence-1)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L13895)
|
||||
|
||||
*Effects*: Equivalent to: return emplace(std::forward<P>(obj));
|
||||
|
||||
[ð](#lib:unordered_map,insert_)
|
||||
|
||||
`template<class P>
|
||||
constexpr iterator insert(const_iterator hint, P&& obj);
|
||||
`
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L13907)
|
||||
|
||||
*Constraints*: is_constructible_v<value_type, P&&> is true[.](#3.sentence-1)
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L13911)
|
||||
|
||||
*Effects*: Equivalent to:return emplace_hint(hint, std::forward<P>(obj));
|
||||
|
||||
[ð](#lib:try_emplace,unordered_map)
|
||||
|
||||
`template<class... Args>
|
||||
constexpr pair<iterator, bool> try_emplace(const key_type& k, Args&&... args);
|
||||
template<class... Args>
|
||||
constexpr iterator try_emplace(const_iterator hint, const key_type& k, Args&&... args);
|
||||
`
|
||||
|
||||
[5](#5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L13926)
|
||||
|
||||
*Preconditions*: value_type is *Cpp17EmplaceConstructible* into unordered_map from piecewise_construct, forward_as_tuple(k),forward_as_tuple(std::forward<Args>(args)...)[.](#5.sentence-1)
|
||||
|
||||
[6](#6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L13932)
|
||||
|
||||
*Effects*: If the map already contains an element
|
||||
whose key is equivalent to k,
|
||||
there is no effect[.](#6.sentence-1)
|
||||
|
||||
Otherwise inserts an object of type value_type constructed with piecewise_construct, forward_as_tuple(k),forward_as_tuple(std::forward<Args>(args)...)[.](#6.sentence-2)
|
||||
|
||||
[7](#7)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L13941)
|
||||
|
||||
*Returns*: In the first overload,
|
||||
the bool component of the returned pair is true if and only if the insertion took place[.](#7.sentence-1)
|
||||
|
||||
The returned iterator points to the map element
|
||||
whose key is equivalent to k[.](#7.sentence-2)
|
||||
|
||||
[8](#8)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L13949)
|
||||
|
||||
*Complexity*: The same as emplace and emplace_hint,
|
||||
respectively[.](#8.sentence-1)
|
||||
|
||||
[ð](#lib:try_emplace,unordered_map_)
|
||||
|
||||
`template<class... Args>
|
||||
constexpr pair<iterator, bool> try_emplace(key_type&& k, Args&&... args);
|
||||
template<class... Args>
|
||||
constexpr iterator try_emplace(const_iterator hint, key_type&& k, Args&&... args);
|
||||
`
|
||||
|
||||
[9](#9)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L13964)
|
||||
|
||||
*Preconditions*: value_type is *Cpp17EmplaceConstructible* into unordered_map from piecewise_construct, forward_as_tuple(std::move(k)),forward_as_tuple(std::forward<Args>(args)...)[.](#9.sentence-1)
|
||||
|
||||
[10](#10)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L13970)
|
||||
|
||||
*Effects*: If the map already contains an element
|
||||
whose key is equivalent to k,
|
||||
there is no effect[.](#10.sentence-1)
|
||||
|
||||
Otherwise inserts an object of type value_type constructed with piecewise_construct, forward_as_tuple(std::move(k)),forward_as_tuple(std::forward<Args>(args)...)[.](#10.sentence-2)
|
||||
|
||||
[11](#11)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L13979)
|
||||
|
||||
*Returns*: In the first overload,
|
||||
the bool component of the returned pair is true if and only if the insertion took place[.](#11.sentence-1)
|
||||
|
||||
The returned iterator points to the map element
|
||||
whose key is equivalent to k[.](#11.sentence-2)
|
||||
|
||||
[12](#12)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L13987)
|
||||
|
||||
*Complexity*: The same as emplace and emplace_hint,
|
||||
respectively[.](#12.sentence-1)
|
||||
|
||||
[ð](#lib:try_emplace,unordered_map__)
|
||||
|
||||
`template<class K, class... Args>
|
||||
constexpr pair<iterator, bool> try_emplace(K&& k, Args&&... args);
|
||||
template<class K, class... Args>
|
||||
constexpr iterator try_emplace(const_iterator hint, K&& k, Args&&... args);
|
||||
`
|
||||
|
||||
[13](#13)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L14002)
|
||||
|
||||
*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[.](#13.sentence-1)
|
||||
|
||||
For the first overload,is_convertible_v<K&&, const_iterator> andis_convertible_v<K&&, iterator> are both false[.](#13.sentence-2)
|
||||
|
||||
[14](#14)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L14010)
|
||||
|
||||
*Preconditions*: value_type is *Cpp17EmplaceConstructible* into unordered_map frompiecewise_construct, forward_as_tuple(std::forward<K>(k)),
|
||||
forward_as_tuple(std::forward<Args>
|
||||
(args)...)[.](#14.sentence-1)
|
||||
|
||||
[15](#15)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L14017)
|
||||
|
||||
*Effects*: If the map already contains an element whose key is equivalent to k,
|
||||
there is no effect[.](#15.sentence-1)
|
||||
|
||||
Otherwise, let h be hash_function()(k)[.](#15.sentence-2)
|
||||
|
||||
Constructs an object u of type value_type with piecewise_construct, forward_as_tuple(std::forward<K>(k)),
|
||||
forward_as_tuple(std::forward<Args>(args)...)[.](#15.sentence-3)
|
||||
|
||||
|
||||
If hash_function()(u.first) != h || contains(u.first) is true,
|
||||
the behavior is undefined[.](#15.sentence-4)
|
||||
|
||||
Inserts u into *this[.](#15.sentence-5)
|
||||
|
||||
[16](#16)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L14029)
|
||||
|
||||
*Returns*: For the first overload,
|
||||
the bool component of the returned pair is true if and only if the insertion took place[.](#16.sentence-1)
|
||||
|
||||
The returned iterator points to the map element
|
||||
whose key is equivalent to k[.](#16.sentence-2)
|
||||
|
||||
[17](#17)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L14037)
|
||||
|
||||
*Complexity*: The same as emplace and emplace_hint, respectively[.](#17.sentence-1)
|
||||
|
||||
[ð](#lib:insert_or_assign,unordered_map)
|
||||
|
||||
`template<class M>
|
||||
constexpr pair<iterator, bool> insert_or_assign(const key_type& k, M&& obj);
|
||||
template<class M>
|
||||
constexpr iterator insert_or_assign(const_iterator hint, const key_type& k, M&& obj);
|
||||
`
|
||||
|
||||
[18](#18)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L14051)
|
||||
|
||||
*Mandates*: is_assignable_v<mapped_type&, M&&> is true[.](#18.sentence-1)
|
||||
|
||||
[19](#19)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L14055)
|
||||
|
||||
*Preconditions*: value_type is *Cpp17EmplaceConstructible* into unordered_map from k, std::forward<M>(obj)[.](#19.sentence-1)
|
||||
|
||||
[20](#20)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L14060)
|
||||
|
||||
*Effects*: If the map already contains an element e whose key is equivalent to k,
|
||||
assigns std::forward<M>(obj) to e.second[.](#20.sentence-1)
|
||||
|
||||
Otherwise inserts an object of type value_type constructed with k, std::forward<M>(obj)[.](#20.sentence-2)
|
||||
|
||||
[21](#21)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L14068)
|
||||
|
||||
*Returns*: In the first overload,
|
||||
the bool component of the returned pair is true if and only if the insertion took place[.](#21.sentence-1)
|
||||
|
||||
The returned iterator points to the map element
|
||||
whose key is equivalent to k[.](#21.sentence-2)
|
||||
|
||||
[22](#22)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L14076)
|
||||
|
||||
*Complexity*: The same as emplace and emplace_hint,
|
||||
respectively[.](#22.sentence-1)
|
||||
|
||||
[ð](#lib:insert_or_assign,unordered_map_)
|
||||
|
||||
`template<class M>
|
||||
constexpr pair<iterator, bool> insert_or_assign(key_type&& k, M&& obj);
|
||||
template<class M>
|
||||
constexpr iterator insert_or_assign(const_iterator hint, key_type&& k, M&& obj);
|
||||
`
|
||||
|
||||
[23](#23)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L14091)
|
||||
|
||||
*Mandates*: is_assignable_v<mapped_type&, M&&> is true[.](#23.sentence-1)
|
||||
|
||||
[24](#24)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L14095)
|
||||
|
||||
*Preconditions*: value_type is *Cpp17EmplaceConstructible* into unordered_map from std::move(k), std::forward<M>(obj)[.](#24.sentence-1)
|
||||
|
||||
[25](#25)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L14100)
|
||||
|
||||
*Effects*: If the map already contains an element e whose key is equivalent to k,
|
||||
assigns std::forward<M>(obj) to e.second[.](#25.sentence-1)
|
||||
|
||||
Otherwise inserts an object of type value_type constructed with std::move(k), std::forward<M>(obj)[.](#25.sentence-2)
|
||||
|
||||
[26](#26)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L14108)
|
||||
|
||||
*Returns*: In the first overload,
|
||||
the bool component of the returned pair is true if and only if the insertion took place[.](#26.sentence-1)
|
||||
|
||||
The returned iterator points to the map element
|
||||
whose key is equivalent to k[.](#26.sentence-2)
|
||||
|
||||
[27](#27)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L14116)
|
||||
|
||||
*Complexity*: The same as emplace and emplace_hint,
|
||||
respectively[.](#27.sentence-1)
|
||||
|
||||
[ð](#lib:insert_or_assign,unordered_map__)
|
||||
|
||||
`template<class K, class M>
|
||||
constexpr pair<iterator, bool> insert_or_assign(K&& k, M&& obj);
|
||||
template<class K, class M>
|
||||
constexpr iterator insert_or_assign(const_iterator hint, K&& k, M&& obj);
|
||||
`
|
||||
|
||||
[28](#28)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L14131)
|
||||
|
||||
*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[.](#28.sentence-1)
|
||||
|
||||
[29](#29)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L14136)
|
||||
|
||||
*Mandates*: is_assignable_v<mapped_type&, M&&> is true[.](#29.sentence-1)
|
||||
|
||||
[30](#30)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L14140)
|
||||
|
||||
*Preconditions*: value_type is *Cpp17EmplaceConstructible* into unordered_map from std::forward<K>
|
||||
(k), std::forward<M>(obj)[.](#30.sentence-1)
|
||||
|
||||
[31](#31)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L14146)
|
||||
|
||||
*Effects*: If the map already contains an element e whose key is equivalent to k,
|
||||
assigns std::forward<M>
|
||||
(obj) to e.second[.](#31.sentence-1)
|
||||
|
||||
Otherwise, let h be hash_function()(k)[.](#31.sentence-2)
|
||||
|
||||
Constructs an object u of type value_type with std::forward<K>(k), std::forward<M>(obj)[.](#31.sentence-3)
|
||||
|
||||
If hash_function()(u.first) != h || contains(u.first) is true,
|
||||
the behavior is undefined[.](#31.sentence-4)
|
||||
|
||||
Inserts u into *this[.](#31.sentence-5)
|
||||
|
||||
[32](#32)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L14158)
|
||||
|
||||
*Returns*: For the first overload,
|
||||
the bool component of the returned pair is true if and only if the insertion took place[.](#32.sentence-1)
|
||||
|
||||
The returned iterator points to the map element
|
||||
whose key is equivalent to k[.](#32.sentence-2)
|
||||
|
||||
[33](#33)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L14166)
|
||||
|
||||
*Complexity*: The same as emplace and emplace_hint, respectively[.](#33.sentence-1)
|
||||
78
cppdraft/unord/map/overview.md
Normal file
78
cppdraft/unord/map/overview.md
Normal file
File diff suppressed because one or more lines are too long
17
cppdraft/unord/map/syn.md
Normal file
17
cppdraft/unord/map/syn.md
Normal file
@@ -0,0 +1,17 @@
|
||||
[unord.map.syn]
|
||||
|
||||
# 23 Containers library [[containers]](./#containers)
|
||||
|
||||
## 23.5 Unordered associative containers [[unord]](unord#map.syn)
|
||||
|
||||
### 23.5.2 Header <unordered_map> synopsis [unord.map.syn]
|
||||
|
||||
[ð](#header:%3cunordered_map%3e)
|
||||
|
||||
#include <compare> // see [[compare.syn]](compare.syn "17.12.1 Header <compare> synopsis")#include <initializer_list> // see [[initializer.list.syn]](initializer.list.syn "17.11.2 Header <initializer_list> synopsis")namespace std {// [[unord.map]](unord.map "23.5.3 Class template unordered_map"), class template unordered_maptemplate<class Key, class T, class Hash = hash<Key>, class Pred = equal_to<Key>, class Alloc = allocator<pair<const Key, T>>>class unordered_map; // [[unord.multimap]](unord.multimap "23.5.4 Class template unordered_multimap"), class template unordered_multimaptemplate<class Key, class T, class Hash = hash<Key>, class Pred = equal_to<Key>, class Alloc = allocator<pair<const Key, T>>>class unordered_multimap; template<class Key, class T, class Hash, class Pred, class Alloc>constexpr bool operator==(const unordered_map<Key, T, Hash, Pred, Alloc>& a, const unordered_map<Key, T, Hash, Pred, Alloc>& b); template<class Key, class T, class Hash, class Pred, class Alloc>constexpr bool operator==(const unordered_multimap<Key, T, Hash, Pred, Alloc>& a, const unordered_multimap<Key, T, Hash, Pred, Alloc>& b); template<class Key, class T, class Hash, class Pred, class Alloc>constexpr void swap(unordered_map<Key, T, Hash, Pred, Alloc>& x,
|
||||
unordered_map<Key, T, Hash, Pred, Alloc>& y)noexcept(noexcept(x.swap(y))); template<class Key, class T, class Hash, class Pred, class Alloc>constexpr void swap(unordered_multimap<Key, T, Hash, Pred, Alloc>& x,
|
||||
unordered_multimap<Key, T, Hash, Pred, Alloc>& y)noexcept(noexcept(x.swap(y))); // [[unord.map.erasure]](unord.map.erasure "23.5.3.5 Erasure"), erasure for unordered_maptemplate<class K, class T, class H, class P, class A, class Predicate>constexpr typename unordered_map<K, T, H, P, A>::size_type
|
||||
erase_if(unordered_map<K, T, H, P, A>& c, Predicate pred); // [[unord.multimap.erasure]](unord.multimap.erasure "23.5.4.4 Erasure"), erasure for unordered_multimaptemplate<class K, class T, class H, class P, class A, class Predicate>constexpr typename unordered_multimap<K, T, H, P, A>::size_type
|
||||
erase_if(unordered_multimap<K, T, H, P, A>& c, Predicate pred); namespace pmr {template<class Key, class T, class Hash = hash<Key>, class Pred = equal_to<Key>>using unordered_map = std::unordered_map<Key, T, Hash, Pred,
|
||||
polymorphic_allocator<pair<const Key, T>>>; template<class Key, class T, class Hash = hash<Key>, class Pred = equal_to<Key>>using unordered_multimap = std::unordered_multimap<Key, T, Hash, Pred,
|
||||
polymorphic_allocator<pair<const Key, T>>>; }}
|
||||
204
cppdraft/unord/multimap.md
Normal file
204
cppdraft/unord/multimap.md
Normal file
File diff suppressed because one or more lines are too long
77
cppdraft/unord/multimap/cnstr.md
Normal file
77
cppdraft/unord/multimap/cnstr.md
Normal file
@@ -0,0 +1,77 @@
|
||||
[unord.multimap.cnstr]
|
||||
|
||||
# 23 Containers library [[containers]](./#containers)
|
||||
|
||||
## 23.5 Unordered associative containers [[unord]](unord#multimap.cnstr)
|
||||
|
||||
### 23.5.4 Class template unordered_multimap [[unord.multimap]](unord.multimap#cnstr)
|
||||
|
||||
#### 23.5.4.2 Constructors [unord.multimap.cnstr]
|
||||
|
||||
[ð](#lib:unordered_multimap,constructor)
|
||||
|
||||
`constexpr unordered_multimap() : unordered_multimap(size_type(see below)) { }
|
||||
constexpr explicit unordered_multimap(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#L14508)
|
||||
|
||||
*Effects*: Constructs an empty unordered_multimap 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#L14517)
|
||||
|
||||
*Complexity*: Constant[.](#2.sentence-1)
|
||||
|
||||
[ð](#lib:unordered_multimap,constructor_)
|
||||
|
||||
`template<class InputIterator>
|
||||
constexpr unordered_multimap(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_multimap(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_multimap(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#L14541)
|
||||
|
||||
*Effects*: Constructs an empty unordered_multimap 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#L14552)
|
||||
|
||||
*Complexity*: Average case linear, worst case quadratic[.](#4.sentence-1)
|
||||
22
cppdraft/unord/multimap/erasure.md
Normal file
22
cppdraft/unord/multimap/erasure.md
Normal file
@@ -0,0 +1,22 @@
|
||||
[unord.multimap.erasure]
|
||||
|
||||
# 23 Containers library [[containers]](./#containers)
|
||||
|
||||
## 23.5 Unordered associative containers [[unord]](unord#multimap.erasure)
|
||||
|
||||
### 23.5.4 Class template unordered_multimap [[unord.multimap]](unord.multimap#erasure)
|
||||
|
||||
#### 23.5.4.4 Erasure [unord.multimap.erasure]
|
||||
|
||||
[ð](#lib:erase_if,unordered_multimap)
|
||||
|
||||
`template<class K, class T, class H, class P, class A, class Predicate>
|
||||
constexpr typename unordered_multimap<K, T, H, P, A>::size_type
|
||||
erase_if(unordered_multimap<K, T, H, P, A>& c, Predicate pred);
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L14602)
|
||||
|
||||
*Effects*: Equivalent to:auto original_size = c.size();for (auto i = c.begin(), last = c.end(); i != last; ) {if (pred(*i)) { i = c.erase(i); } else {++i; }}return original_size - c.size();
|
||||
45
cppdraft/unord/multimap/modifiers.md
Normal file
45
cppdraft/unord/multimap/modifiers.md
Normal file
@@ -0,0 +1,45 @@
|
||||
[unord.multimap.modifiers]
|
||||
|
||||
# 23 Containers library [[containers]](./#containers)
|
||||
|
||||
## 23.5 Unordered associative containers [[unord]](unord#multimap.modifiers)
|
||||
|
||||
### 23.5.4 Class template unordered_multimap [[unord.multimap]](unord.multimap#modifiers)
|
||||
|
||||
#### 23.5.4.3 Modifiers [unord.multimap.modifiers]
|
||||
|
||||
[ð](#lib:unordered_multimap,insert)
|
||||
|
||||
`template<class P>
|
||||
constexpr iterator insert(P&& obj);
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L14566)
|
||||
|
||||
*Constraints*: is_constructible_v<value_type, P&&> is true[.](#1.sentence-1)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L14570)
|
||||
|
||||
*Effects*: Equivalent to: return emplace(std::forward<P>(obj));
|
||||
|
||||
[ð](#lib:unordered_multimap,insert_)
|
||||
|
||||
`template<class P>
|
||||
constexpr iterator insert(const_iterator hint, P&& obj);
|
||||
`
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L14582)
|
||||
|
||||
*Constraints*: is_constructible_v<value_type, P&&> is true[.](#3.sentence-1)
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L14586)
|
||||
|
||||
*Effects*: Equivalent to:return emplace_hint(hint, std::forward<P>(obj));
|
||||
81
cppdraft/unord/multimap/overview.md
Normal file
81
cppdraft/unord/multimap/overview.md
Normal file
File diff suppressed because one or more lines are too long
170
cppdraft/unord/multiset.md
Normal file
170
cppdraft/unord/multiset.md
Normal file
File diff suppressed because one or more lines are too long
77
cppdraft/unord/multiset/cnstr.md
Normal file
77
cppdraft/unord/multiset/cnstr.md
Normal file
@@ -0,0 +1,77 @@
|
||||
[unord.multiset.cnstr]
|
||||
|
||||
# 23 Containers library [[containers]](./#containers)
|
||||
|
||||
## 23.5 Unordered associative containers [[unord]](unord#multiset.cnstr)
|
||||
|
||||
### 23.5.7 Class template unordered_multiset [[unord.multiset]](unord.multiset#cnstr)
|
||||
|
||||
#### 23.5.7.2 Constructors [unord.multiset.cnstr]
|
||||
|
||||
[ð](#lib:unordered_multiset,constructor)
|
||||
|
||||
`constexpr unordered_multiset() : unordered_multiset(size_type(see below)) { }
|
||||
constexpr explicit unordered_multiset(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#L15404)
|
||||
|
||||
*Effects*: Constructs an empty unordered_multiset 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#L15413)
|
||||
|
||||
*Complexity*: Constant[.](#2.sentence-1)
|
||||
|
||||
[ð](#lib:unordered_multiset,constructor_)
|
||||
|
||||
`template<class InputIterator>
|
||||
constexpr unordered_multiset(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_multiset(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_multiset(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#L15437)
|
||||
|
||||
*Effects*: Constructs an empty unordered_multiset 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#L15448)
|
||||
|
||||
*Complexity*: Average case linear, worst case quadratic[.](#4.sentence-1)
|
||||
22
cppdraft/unord/multiset/erasure.md
Normal file
22
cppdraft/unord/multiset/erasure.md
Normal file
@@ -0,0 +1,22 @@
|
||||
[unord.multiset.erasure]
|
||||
|
||||
# 23 Containers library [[containers]](./#containers)
|
||||
|
||||
## 23.5 Unordered associative containers [[unord]](unord#multiset.erasure)
|
||||
|
||||
### 23.5.7 Class template unordered_multiset [[unord.multiset]](unord.multiset#erasure)
|
||||
|
||||
#### 23.5.7.3 Erasure [unord.multiset.erasure]
|
||||
|
||||
[ð](#lib:erase_if,unordered_multiset)
|
||||
|
||||
`template<class K, class H, class P, class A, class Predicate>
|
||||
constexpr typename unordered_multiset<K, H, P, A>::size_type
|
||||
erase_if(unordered_multiset<K, H, P, A>& c, Predicate pred);
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L15463)
|
||||
|
||||
*Effects*: Equivalent to:auto original_size = c.size();for (auto i = c.begin(), last = c.end(); i != last; ) {if (pred(*i)) { i = c.erase(i); } else {++i; }}return original_size - c.size();
|
||||
85
cppdraft/unord/multiset/overview.md
Normal file
85
cppdraft/unord/multiset/overview.md
Normal file
File diff suppressed because one or more lines are too long
2346
cppdraft/unord/req.md
Normal file
2346
cppdraft/unord/req.md
Normal file
File diff suppressed because it is too large
Load Diff
42
cppdraft/unord/req/except.md
Normal file
42
cppdraft/unord/req/except.md
Normal file
@@ -0,0 +1,42 @@
|
||||
[unord.req.except]
|
||||
|
||||
# 23 Containers library [[containers]](./#containers)
|
||||
|
||||
## 23.2 Requirements [[container.requirements]](container.requirements#unord.req.except)
|
||||
|
||||
### 23.2.8 Unordered associative containers [[unord.req]](unord.req#except)
|
||||
|
||||
#### 23.2.8.2 Exception safety guarantees [unord.req.except]
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L6009)
|
||||
|
||||
For unordered associative containers, no clear() function
|
||||
throws an exception[.](#1.sentence-1)
|
||||
|
||||
erase(k) does not throw an
|
||||
exception unless that exception is thrown by the container's Hash orPred object (if any)[.](#1.sentence-2)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L6017)
|
||||
|
||||
For unordered associative containers, if an exception is thrown by any
|
||||
operation other than the container's hash function from within aninsert or emplace function inserting a single element,
|
||||
the insertion has no effect[.](#2.sentence-1)
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L6023)
|
||||
|
||||
For unordered associative containers, no swap function throws
|
||||
an exception unless that exception is thrown by the swap of the container'sHash or Pred object (if any)[.](#3.sentence-1)
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L6028)
|
||||
|
||||
For unordered associative containers, if an exception is thrown
|
||||
from within a rehash() function other than by the container's hash
|
||||
function or comparison function, the rehash() function has no effect[.](#4.sentence-1)
|
||||
2311
cppdraft/unord/req/general.md
Normal file
2311
cppdraft/unord/req/general.md
Normal file
File diff suppressed because it is too large
Load Diff
223
cppdraft/unord/set.md
Normal file
223
cppdraft/unord/set.md
Normal file
File diff suppressed because one or more lines are too long
77
cppdraft/unord/set/cnstr.md
Normal file
77
cppdraft/unord/set/cnstr.md
Normal file
@@ -0,0 +1,77 @@
|
||||
[unord.set.cnstr]
|
||||
|
||||
# 23 Containers library [[containers]](./#containers)
|
||||
|
||||
## 23.5 Unordered associative containers [[unord]](unord#set.cnstr)
|
||||
|
||||
### 23.5.6 Class template unordered_set [[unord.set]](unord.set#cnstr)
|
||||
|
||||
#### 23.5.6.2 Constructors [unord.set.cnstr]
|
||||
|
||||
[ð](#lib:unordered_set,constructor)
|
||||
|
||||
`constexpr unordered_set() : unordered_set(size_type(see below)) { }
|
||||
constexpr explicit unordered_set(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#L14986)
|
||||
|
||||
*Effects*: Constructs an empty unordered_set 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#L14995)
|
||||
|
||||
*Complexity*: Constant[.](#2.sentence-1)
|
||||
|
||||
[ð](#lib:unordered_set,constructor_)
|
||||
|
||||
`template<class InputIterator>
|
||||
constexpr unordered_set(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_multiset(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_set(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#L15019)
|
||||
|
||||
*Effects*: Constructs an empty unordered_set 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#L15030)
|
||||
|
||||
*Complexity*: Average case linear, worst case quadratic[.](#4.sentence-1)
|
||||
22
cppdraft/unord/set/erasure.md
Normal file
22
cppdraft/unord/set/erasure.md
Normal file
@@ -0,0 +1,22 @@
|
||||
[unord.set.erasure]
|
||||
|
||||
# 23 Containers library [[containers]](./#containers)
|
||||
|
||||
## 23.5 Unordered associative containers [[unord]](unord#set.erasure)
|
||||
|
||||
### 23.5.6 Class template unordered_set [[unord.set]](unord.set#erasure)
|
||||
|
||||
#### 23.5.6.3 Erasure [unord.set.erasure]
|
||||
|
||||
[ð](#lib:erase_if,unordered_set)
|
||||
|
||||
`template<class K, class H, class P, class A, class Predicate>
|
||||
constexpr typename unordered_set<K, H, P, A>::size_type
|
||||
erase_if(unordered_set<K, H, P, A>& c, Predicate pred);
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L15045)
|
||||
|
||||
*Effects*: Equivalent to:auto original_size = c.size();for (auto i = c.begin(), last = c.end(); i != last; ) {if (pred(*i)) { i = c.erase(i); } else {++i; }}return original_size - c.size();
|
||||
62
cppdraft/unord/set/modifiers.md
Normal file
62
cppdraft/unord/set/modifiers.md
Normal file
@@ -0,0 +1,62 @@
|
||||
[unord.set.modifiers]
|
||||
|
||||
# 23 Containers library [[containers]](./#containers)
|
||||
|
||||
## 23.5 Unordered associative containers [[unord]](unord#set.modifiers)
|
||||
|
||||
### 23.5.6 Class template unordered_set [[unord.set]](unord.set#modifiers)
|
||||
|
||||
#### 23.5.6.4 Modifiers [unord.set.modifiers]
|
||||
|
||||
[ð](#lib:insert,unordered_set)
|
||||
|
||||
`template<class K> constexpr pair<iterator, bool> insert(K&& obj);
|
||||
template<class K> constexpr iterator insert(const_iterator hint, K&& obj);
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L15070)
|
||||
|
||||
*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[.](#1.sentence-1)
|
||||
|
||||
For the second overload,is_convertible_v<K&&, const_iterator> andis_convertible_v<K&&, iterator> are both false[.](#1.sentence-2)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L15078)
|
||||
|
||||
*Preconditions*: value_type is *Cpp17EmplaceConstructible* into unordered_set from std::forward<K>
|
||||
(obj)[.](#2.sentence-1)
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L15083)
|
||||
|
||||
*Effects*: If the set already contains an element that is equivalent to obj,
|
||||
there is no effect[.](#3.sentence-1)
|
||||
|
||||
Otherwise, let h be hash_function()(obj)[.](#3.sentence-2)
|
||||
|
||||
Constructs an object u of type value_type with std::forward<K>(obj)[.](#3.sentence-3)
|
||||
|
||||
If hash_function()(u) != h || contains(u) is true,
|
||||
the behavior is undefined[.](#3.sentence-4)
|
||||
|
||||
Inserts u into *this[.](#3.sentence-5)
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L15094)
|
||||
|
||||
*Returns*: For the first overload,
|
||||
the bool component of the returned pair is true if and only if the insertion took place[.](#4.sentence-1)
|
||||
|
||||
The returned iterator points to the set element
|
||||
that is equivalent to obj[.](#4.sentence-2)
|
||||
|
||||
[5](#5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L15102)
|
||||
|
||||
*Complexity*: Average case constant, worst case linear[.](#5.sentence-1)
|
||||
83
cppdraft/unord/set/overview.md
Normal file
83
cppdraft/unord/set/overview.md
Normal file
File diff suppressed because one or more lines are too long
17
cppdraft/unord/set/syn.md
Normal file
17
cppdraft/unord/set/syn.md
Normal file
@@ -0,0 +1,17 @@
|
||||
[unord.set.syn]
|
||||
|
||||
# 23 Containers library [[containers]](./#containers)
|
||||
|
||||
## 23.5 Unordered associative containers [[unord]](unord#set.syn)
|
||||
|
||||
### 23.5.5 Header <unordered_set> synopsis [unord.set.syn]
|
||||
|
||||
[ð](#header:%3cunordered_set%3e)
|
||||
|
||||
#include <compare> // see [[compare.syn]](compare.syn "17.12.1 Header <compare> synopsis")#include <initializer_list> // see [[initializer.list.syn]](initializer.list.syn "17.11.2 Header <initializer_list> synopsis")namespace std {// [[unord.set]](unord.set "23.5.6 Class template unordered_set"), class template unordered_settemplate<class Key, class Hash = hash<Key>, class Pred = equal_to<Key>, class Alloc = allocator<Key>>class unordered_set; // [[unord.multiset]](unord.multiset "23.5.7 Class template unordered_multiset"), class template unordered_multisettemplate<class Key, class Hash = hash<Key>, class Pred = equal_to<Key>, class Alloc = allocator<Key>>class unordered_multiset; template<class Key, class Hash, class Pred, class Alloc>constexpr bool operator==(const unordered_set<Key, Hash, Pred, Alloc>& a, const unordered_set<Key, Hash, Pred, Alloc>& b); template<class Key, class Hash, class Pred, class Alloc>constexpr bool operator==(const unordered_multiset<Key, Hash, Pred, Alloc>& a, const unordered_multiset<Key, Hash, Pred, Alloc>& b); template<class Key, class Hash, class Pred, class Alloc>constexpr void swap(unordered_set<Key, Hash, Pred, Alloc>& x,
|
||||
unordered_set<Key, Hash, Pred, Alloc>& y)noexcept(noexcept(x.swap(y))); template<class Key, class Hash, class Pred, class Alloc>constexpr void swap(unordered_multiset<Key, Hash, Pred, Alloc>& x,
|
||||
unordered_multiset<Key, Hash, Pred, Alloc>& y)noexcept(noexcept(x.swap(y))); // [[unord.set.erasure]](unord.set.erasure "23.5.6.3 Erasure"), erasure for unordered_settemplate<class K, class H, class P, class A, class Predicate>constexpr typename unordered_set<K, H, P, A>::size_type
|
||||
erase_if(unordered_set<K, H, P, A>& c, Predicate pred); // [[unord.multiset.erasure]](unord.multiset.erasure "23.5.7.3 Erasure"), erasure for unordered_multisettemplate<class K, class H, class P, class A, class Predicate>constexpr typename unordered_multiset<K, H, P, A>::size_type
|
||||
erase_if(unordered_multiset<K, H, P, A>& c, Predicate pred); namespace pmr {template<class Key, class Hash = hash<Key>, class Pred = equal_to<Key>>using unordered_set = std::unordered_set<Key, Hash, Pred,
|
||||
polymorphic_allocator<Key>>; template<class Key, class Hash = hash<Key>, class Pred = equal_to<Key>>using unordered_multiset = std::unordered_multiset<Key, Hash, Pred,
|
||||
polymorphic_allocator<Key>>; }}
|
||||
Reference in New Issue
Block a user