From Jason Turner

[flat.set.modifiers]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpb5rmcvxw/{from.md → to.md} +107 -0
tmp/tmpb5rmcvxw/{from.md → to.md} RENAMED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #### Modifiers <a id="flat.set.modifiers">[[flat.set.modifiers]]</a>
2
+
3
+ ``` cpp
4
+ template<class K> pair<iterator, bool> insert(K&& x);
5
+ template<class K> iterator insert(const_iterator hint, K&& x);
6
+ ```
7
+
8
+ *Constraints:* The *qualified-id* `Compare::is_transparent` is valid and
9
+ denotes a type. `is_constructible_v<value_type, K>` is `true`.
10
+
11
+ *Preconditions:* The conversion from `x` into `value_type` constructs an
12
+ object `u`, for which `find(x) == find(u)` is true.
13
+
14
+ *Effects:* If the set already contains an element equivalent to `x`,
15
+ `*this` and `x` are unchanged. Otherwise, inserts a new element as if by
16
+ `emplace(std::forward<K>(x))`.
17
+
18
+ *Returns:* In the first overload, the `bool` component of the returned
19
+ pair is `true` if and only if the insertion took place. The returned
20
+ iterator points to the element whose key is equivalent to `x`.
21
+
22
+ ``` cpp
23
+ template<class InputIterator>
24
+ void insert(InputIterator first, InputIterator last);
25
+ ```
26
+
27
+ *Effects:* Adds elements to *c* as if by:
28
+
29
+ ``` cpp
30
+ c.insert(c.end(), first, last);
31
+ ```
32
+
33
+ Then, sorts the range of newly inserted elements with respect to
34
+ *compare*; merges the resulting sorted range and the sorted range of
35
+ pre-existing elements into a single sorted range; and finally erases all
36
+ but the first element from each group of consecutive equivalent
37
+ elements.
38
+
39
+ *Complexity:* N + M log M, where N is `size()` before the operation and
40
+ M is `distance(first, last)`.
41
+
42
+ *Remarks:* Since this operation performs an in-place merge, it may
43
+ allocate memory.
44
+
45
+ ``` cpp
46
+ template<class InputIterator>
47
+ void insert(sorted_unique_t, InputIterator first, InputIterator last);
48
+ ```
49
+
50
+ *Effects:* Equivalent to `insert(first, last)`.
51
+
52
+ *Complexity:* Linear.
53
+
54
+ ``` cpp
55
+ template<container-compatible-range<value_type> R>
56
+ void insert_range(R&& rg);
57
+ ```
58
+
59
+ *Effects:* Adds elements to *c* as if by:
60
+
61
+ ``` cpp
62
+ for (const auto& e : rg) {
63
+ c.insert(c.end(), e);
64
+ }
65
+ ```
66
+
67
+ Then, sorts the range of newly inserted elements with respect to
68
+ *compare*; merges the resulting sorted range and the sorted range of
69
+ pre-existing elements into a single sorted range; and finally erases all
70
+ but the first element from each group of consecutive equivalent
71
+ elements.
72
+
73
+ *Complexity:* N + M log M, where N is `size()` before the operation and
74
+ M is `ranges::distance(rg)`.
75
+
76
+ *Remarks:* Since this operation performs an in-place merge, it may
77
+ allocate memory.
78
+
79
+ ``` cpp
80
+ void swap(flat_set& y) noexcept;
81
+ ```
82
+
83
+ *Effects:* Equivalent to:
84
+
85
+ ``` cpp
86
+ ranges::swap(compare, y.compare);
87
+ ranges::swap(c, y.c);
88
+ ```
89
+
90
+ ``` cpp
91
+ container_type extract() &&;
92
+ ```
93
+
94
+ *Ensures:* `*this` is emptied, even if the function exits via an
95
+ exception.
96
+
97
+ *Returns:* `std::move(`*`c`*`)`.
98
+
99
+ ``` cpp
100
+ void replace(container_type&& cont);
101
+ ```
102
+
103
+ *Preconditions:* The elements of `cont` are sorted with respect to
104
+ *compare*, and `cont` contains no equal elements.
105
+
106
+ *Effects:* Equivalent to: *`c`*` = std::move(cont);`
107
+