From Jason Turner

[map.modifiers]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpqyeqa27u/{from.md → to.md} +94 -5
tmp/tmpqyeqa27u/{from.md → to.md} RENAMED
@@ -1,16 +1,105 @@
1
  #### `map` modifiers <a id="map.modifiers">[[map.modifiers]]</a>
2
 
3
  ``` cpp
4
- template <class P> pair<iterator, bool> insert(P&& x);
5
- template <class P> iterator insert(const_iterator position, P&& x);
6
- template <class InputIterator>
7
- void insert(InputIterator first, InputIterator last);
8
  ```
9
 
10
  *Effects:* The first form is equivalent to
11
  `return emplace(std::forward<P>(x))`. The second form is equivalent to
12
  `return emplace_hint(position, std::forward<P>(x))`.
13
 
14
  *Remarks:* These signatures shall not participate in overload resolution
15
- unless `std::is_constructible<value_type, P&&>::value` is `true`.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
 
 
1
  #### `map` 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
  *Effects:* The first form is equivalent to
11
  `return emplace(std::forward<P>(x))`. The second form is equivalent to
12
  `return emplace_hint(position, std::forward<P>(x))`.
13
 
14
  *Remarks:* These signatures shall not participate in overload resolution
15
+ unless `is_constructible_v<value_type, P&&>` is `true`.
16
+
17
+ ``` cpp
18
+ template <class... Args>
19
+ pair<iterator, bool> try_emplace(const key_type& k, Args&&... args);
20
+ template <class... Args>
21
+ iterator try_emplace(const_iterator hint, const key_type& k, Args&&... args);
22
+ ```
23
+
24
+ *Requires:* `value_type` shall be `EmplaceConstructible` into `map` from
25
+ `piecewise_construct`, `forward_as_tuple(k)`,
26
+ `forward_as_tuple(std::forward<Args>(args)...)`.
27
+
28
+ *Effects:* If the map already contains an element whose key is
29
+ equivalent to `k`, there is no effect. Otherwise inserts an object of
30
+ type `value_type` constructed with `piecewise_construct`,
31
+ `forward_as_tuple(k)`, `forward_as_tuple(std::forward<Args>(args)...)`.
32
+
33
+ *Returns:* In the first overload, the `bool` component of the returned
34
+ pair is `true` if and only if the insertion took place. The returned
35
+ iterator points to the map element whose key is equivalent to `k`.
36
+
37
+ *Complexity:* The same as `emplace` and `emplace_hint`, respectively.
38
+
39
+ ``` cpp
40
+ template <class... Args>
41
+ pair<iterator, bool> try_emplace(key_type&& k, Args&&... args);
42
+ template <class... Args>
43
+ iterator try_emplace(const_iterator hint, key_type&& k, Args&&... args);
44
+ ```
45
+
46
+ *Requires:* `value_type` shall be `EmplaceConstructible` into `map` from
47
+ `piecewise_construct`, `forward_as_tuple(std::move(k))`,
48
+ `forward_as_tuple(std::forward<Args>(args)...)`.
49
+
50
+ *Effects:* If the map already contains an element whose key is
51
+ equivalent to `k`, there is no effect. Otherwise inserts an object of
52
+ type `value_type` constructed with `piecewise_construct`,
53
+ `forward_as_tuple(std::move(k))`,
54
+ `forward_as_tuple(std::forward<Args>(args)...)`.
55
+
56
+ *Returns:* In the first overload, the `bool` component of the returned
57
+ pair is `true` if and only if the insertion took place. The returned
58
+ iterator points to the map element whose key is equivalent to `k`.
59
+
60
+ *Complexity:* The same as `emplace` and `emplace_hint`, respectively.
61
+
62
+ ``` cpp
63
+ template <class M>
64
+ pair<iterator, bool> insert_or_assign(const key_type& k, M&& obj);
65
+ template <class M>
66
+ iterator insert_or_assign(const_iterator hint, const key_type& k, M&& obj);
67
+ ```
68
+
69
+ *Requires:* `is_assignable_v<mapped_type&, M&&>` shall be `true`.
70
+ `value_type` shall be `EmplaceConstructible` into `map` from `k`,
71
+ `forward<M>(obj)`.
72
+
73
+ *Effects:* If the map already contains an element `e` whose key is
74
+ equivalent to `k`, assigns `std::forward<M>(obj)` to `e.second`.
75
+ Otherwise inserts an object of type `value_type` constructed with `k`,
76
+ `std::forward<M>(obj)`.
77
+
78
+ *Returns:* In the first overload, the `bool` component of the returned
79
+ pair is `true` if and only if the insertion took place. The returned
80
+ 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
+ *Requires:* `is_assignable_v<mapped_type&, M&&>` shall be `true`.
92
+ `value_type` shall be `EmplaceConstructible` into `map` from `move(k)`,
93
+ `forward<M>(obj)`.
94
+
95
+ *Effects:* If the map already contains an element `e` whose key is
96
+ equivalent to `k`, assigns `std::forward<M>(obj)` to `e.second`.
97
+ Otherwise inserts an object of type `value_type` constructed with
98
+ `std::move(k)`, `std::forward<M>(obj)`.
99
+
100
+ *Returns:* In the first overload, the `bool` component of the returned
101
+ pair is `true` if and only if the insertion took place. The returned
102
+ iterator points to the map element whose key is equivalent to `k`.
103
+
104
+ *Complexity:* The same as `emplace` and `emplace_hint`, respectively.
105