tmp/tmpqxu3grfv/{from.md → to.md}
RENAMED
|
@@ -1,25 +1,25 @@
|
|
| 1 |
#### Modifiers <a id="map.modifiers">[[map.modifiers]]</a>
|
| 2 |
|
| 3 |
``` cpp
|
| 4 |
template<class P>
|
| 5 |
-
pair<iterator, bool> insert(P&& x);
|
| 6 |
template<class P>
|
| 7 |
-
iterator insert(const_iterator position, P&& x);
|
| 8 |
```
|
| 9 |
|
| 10 |
*Constraints:* `is_constructible_v<value_type, P&&>` is `true`.
|
| 11 |
|
| 12 |
*Effects:* The first form is equivalent to
|
| 13 |
`return emplace(std::forward<P>(x))`. The second form is equivalent to
|
| 14 |
`return emplace_hint(position, std::forward<P>(x))`.
|
| 15 |
|
| 16 |
``` cpp
|
| 17 |
template<class... Args>
|
| 18 |
-
pair<iterator, bool> try_emplace(const key_type& k, Args&&... args);
|
| 19 |
template<class... Args>
|
| 20 |
-
iterator try_emplace(const_iterator hint, const key_type& k, Args&&... args);
|
| 21 |
```
|
| 22 |
|
| 23 |
*Preconditions:* `value_type` is *Cpp17EmplaceConstructible* into `map`
|
| 24 |
from `piecewise_construct`, `forward_as_tuple(k)`,
|
| 25 |
`forward_as_tuple(std::forward<Args>(args)...)`.
|
|
@@ -35,13 +35,13 @@ iterator points to the map element whose key is equivalent to `k`.
|
|
| 35 |
|
| 36 |
*Complexity:* The same as `emplace` and `emplace_hint`, respectively.
|
| 37 |
|
| 38 |
``` cpp
|
| 39 |
template<class... Args>
|
| 40 |
-
pair<iterator, bool> try_emplace(key_type&& k, Args&&... args);
|
| 41 |
template<class... Args>
|
| 42 |
-
iterator try_emplace(const_iterator hint, key_type&& k, Args&&... args);
|
| 43 |
```
|
| 44 |
|
| 45 |
*Preconditions:* `value_type` is *Cpp17EmplaceConstructible* into `map`
|
| 46 |
from `piecewise_construct`, `forward_as_tuple(std::move(k))`,
|
| 47 |
`forward_as_tuple(std::forward<Args>(args)...)`.
|
|
@@ -56,15 +56,44 @@ type `value_type` constructed with `piecewise_construct`,
|
|
| 56 |
pair is `true` if and only if the insertion took place. The returned
|
| 57 |
iterator points to the map element whose key is equivalent to `k`.
|
| 58 |
|
| 59 |
*Complexity:* The same as `emplace` and `emplace_hint`, respectively.
|
| 60 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 61 |
``` cpp
|
| 62 |
template<class M>
|
| 63 |
-
pair<iterator, bool> insert_or_assign(const key_type& k, M&& obj);
|
| 64 |
template<class M>
|
| 65 |
-
iterator insert_or_assign(const_iterator hint, const key_type& k, M&& obj);
|
| 66 |
```
|
| 67 |
|
| 68 |
*Mandates:* `is_assignable_v<mapped_type&, M&&>` is `true`.
|
| 69 |
|
| 70 |
*Preconditions:* `value_type` is *Cpp17EmplaceConstructible* into `map`
|
|
@@ -81,13 +110,13 @@ iterator points to the map element whose key is equivalent to `k`.
|
|
| 81 |
|
| 82 |
*Complexity:* The same as `emplace` and `emplace_hint`, respectively.
|
| 83 |
|
| 84 |
``` cpp
|
| 85 |
template<class M>
|
| 86 |
-
pair<iterator, bool> insert_or_assign(key_type&& k, M&& obj);
|
| 87 |
template<class M>
|
| 88 |
-
iterator insert_or_assign(const_iterator hint, key_type&& k, M&& obj);
|
| 89 |
```
|
| 90 |
|
| 91 |
*Mandates:* `is_assignable_v<mapped_type&, M&&>` is `true`.
|
| 92 |
|
| 93 |
*Preconditions:* `value_type` is *Cpp17EmplaceConstructible* into `map`
|
|
@@ -102,5 +131,33 @@ Otherwise inserts an object of type `value_type` constructed with
|
|
| 102 |
pair is `true` if and only if the insertion took place. The returned
|
| 103 |
iterator points to the map element whose key is equivalent to `k`.
|
| 104 |
|
| 105 |
*Complexity:* The same as `emplace` and `emplace_hint`, respectively.
|
| 106 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
#### Modifiers <a id="map.modifiers">[[map.modifiers]]</a>
|
| 2 |
|
| 3 |
``` cpp
|
| 4 |
template<class P>
|
| 5 |
+
constexpr pair<iterator, bool> insert(P&& x);
|
| 6 |
template<class P>
|
| 7 |
+
constexpr iterator insert(const_iterator position, P&& x);
|
| 8 |
```
|
| 9 |
|
| 10 |
*Constraints:* `is_constructible_v<value_type, P&&>` is `true`.
|
| 11 |
|
| 12 |
*Effects:* The first form is equivalent to
|
| 13 |
`return emplace(std::forward<P>(x))`. The second form is equivalent to
|
| 14 |
`return emplace_hint(position, std::forward<P>(x))`.
|
| 15 |
|
| 16 |
``` cpp
|
| 17 |
template<class... Args>
|
| 18 |
+
constexpr pair<iterator, bool> try_emplace(const key_type& k, Args&&... args);
|
| 19 |
template<class... Args>
|
| 20 |
+
constexpr iterator try_emplace(const_iterator hint, const key_type& k, Args&&... args);
|
| 21 |
```
|
| 22 |
|
| 23 |
*Preconditions:* `value_type` is *Cpp17EmplaceConstructible* into `map`
|
| 24 |
from `piecewise_construct`, `forward_as_tuple(k)`,
|
| 25 |
`forward_as_tuple(std::forward<Args>(args)...)`.
|
|
|
|
| 35 |
|
| 36 |
*Complexity:* The same as `emplace` and `emplace_hint`, respectively.
|
| 37 |
|
| 38 |
``` cpp
|
| 39 |
template<class... Args>
|
| 40 |
+
constexpr pair<iterator, bool> try_emplace(key_type&& k, Args&&... args);
|
| 41 |
template<class... Args>
|
| 42 |
+
constexpr iterator try_emplace(const_iterator hint, key_type&& k, Args&&... args);
|
| 43 |
```
|
| 44 |
|
| 45 |
*Preconditions:* `value_type` is *Cpp17EmplaceConstructible* into `map`
|
| 46 |
from `piecewise_construct`, `forward_as_tuple(std::move(k))`,
|
| 47 |
`forward_as_tuple(std::forward<Args>(args)...)`.
|
|
|
|
| 56 |
pair is `true` if and only if the insertion took place. The returned
|
| 57 |
iterator points to the map element whose key is equivalent to `k`.
|
| 58 |
|
| 59 |
*Complexity:* The same as `emplace` and `emplace_hint`, respectively.
|
| 60 |
|
| 61 |
+
``` cpp
|
| 62 |
+
template<class K, class... Args>
|
| 63 |
+
constexpr pair<iterator, bool> try_emplace(K&& k, Args&&... args);
|
| 64 |
+
template<class K, class... Args>
|
| 65 |
+
constexpr iterator try_emplace(const_iterator hint, K&& k, Args&&... args);
|
| 66 |
+
```
|
| 67 |
+
|
| 68 |
+
*Constraints:* The *qualified-id* `Compare::is_transparent` is valid and
|
| 69 |
+
denotes a type. For the first overload,
|
| 70 |
+
`is_convertible_v<K&&, const_iterator>` and
|
| 71 |
+
`is_convertible_v<K&&, iterator>` are both `false`.
|
| 72 |
+
|
| 73 |
+
*Preconditions:* `value_type` is *Cpp17EmplaceConstructible* into `map`
|
| 74 |
+
from
|
| 75 |
+
`piecewise_construct, forward_as_tuple(std::forward<K>(k)), forward_as_tuple(std::forward<Args>(args)...)`.
|
| 76 |
+
|
| 77 |
+
*Effects:* If the map already contains an element whose key is
|
| 78 |
+
equivalent to `k`, there is no effect. Otherwise, let `r` be
|
| 79 |
+
`equal_range(k)`. Constructs an object `u` of type `value_type` with
|
| 80 |
+
`piecewise_construct, forward_as_tuple(std::forward<K>(k)), forward_as_tuple(std::forward<Args>(args)...)`.
|
| 81 |
+
If `equal_range(u.first) == r` is `false`, the behavior is undefined.
|
| 82 |
+
Inserts `u` into `*this`.
|
| 83 |
+
|
| 84 |
+
*Returns:* For the first overload, the `bool` component of the returned
|
| 85 |
+
pair is `true` if and only if the insertion took place. The returned
|
| 86 |
+
iterator points to the map element whose key is equivalent to `k`.
|
| 87 |
+
|
| 88 |
+
*Complexity:* The same as `emplace` and `emplace_hint`, respectively.
|
| 89 |
+
|
| 90 |
``` cpp
|
| 91 |
template<class M>
|
| 92 |
+
constexpr pair<iterator, bool> insert_or_assign(const key_type& k, M&& obj);
|
| 93 |
template<class M>
|
| 94 |
+
constexpr iterator insert_or_assign(const_iterator hint, const key_type& k, M&& obj);
|
| 95 |
```
|
| 96 |
|
| 97 |
*Mandates:* `is_assignable_v<mapped_type&, M&&>` is `true`.
|
| 98 |
|
| 99 |
*Preconditions:* `value_type` is *Cpp17EmplaceConstructible* into `map`
|
|
|
|
| 110 |
|
| 111 |
*Complexity:* The same as `emplace` and `emplace_hint`, respectively.
|
| 112 |
|
| 113 |
``` cpp
|
| 114 |
template<class M>
|
| 115 |
+
constexpr pair<iterator, bool> insert_or_assign(key_type&& k, M&& obj);
|
| 116 |
template<class M>
|
| 117 |
+
constexpr iterator insert_or_assign(const_iterator hint, key_type&& k, M&& obj);
|
| 118 |
```
|
| 119 |
|
| 120 |
*Mandates:* `is_assignable_v<mapped_type&, M&&>` is `true`.
|
| 121 |
|
| 122 |
*Preconditions:* `value_type` is *Cpp17EmplaceConstructible* into `map`
|
|
|
|
| 131 |
pair is `true` if and only if the insertion took place. The returned
|
| 132 |
iterator points to the map element whose key is equivalent to `k`.
|
| 133 |
|
| 134 |
*Complexity:* The same as `emplace` and `emplace_hint`, respectively.
|
| 135 |
|
| 136 |
+
``` cpp
|
| 137 |
+
template<class K, class M>
|
| 138 |
+
constexpr pair<iterator, bool> insert_or_assign(K&& k, M&& obj);
|
| 139 |
+
template<class K, class M>
|
| 140 |
+
constexpr iterator insert_or_assign(const_iterator hint, K&& k, M&& obj);
|
| 141 |
+
```
|
| 142 |
+
|
| 143 |
+
*Constraints:* The *qualified-id* `Compare::is_transparent` is valid and
|
| 144 |
+
denotes a type.
|
| 145 |
+
|
| 146 |
+
*Mandates:* `is_assignable_v<mapped_type&, M&&>` is `true`.
|
| 147 |
+
|
| 148 |
+
*Preconditions:* `value_type` is *Cpp17EmplaceConstructible* into `map`
|
| 149 |
+
from `std::forward<K>(k), std:: forward<M>(obj)`.
|
| 150 |
+
|
| 151 |
+
*Effects:* If the map already contains an element `e` whose key is
|
| 152 |
+
equivalent to `k`, assigns `std::forward<M> (obj)` to `e.second`.
|
| 153 |
+
Otherwise, let `r` be `equal_range(k)`. Constructs an object `u` of type
|
| 154 |
+
`value_type` with `std::forward<K>(k), std::forward<M>(obj)`. If
|
| 155 |
+
`equal_range(u.first) == r` is `false`, the behavior is undefined.
|
| 156 |
+
Inserts `u` into `*this`.
|
| 157 |
+
|
| 158 |
+
*Returns:* For the first overload, the `bool` component of the returned
|
| 159 |
+
pair is `true` if and only if the insertion took place. The returned
|
| 160 |
+
iterator points to the map element whose key is equivalent to `k`.
|
| 161 |
+
|
| 162 |
+
*Complexity:* The same as `emplace` and `emplace_hint`, respectively.
|
| 163 |
+
|