From Jason Turner

[set]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp2duy56fb/{from.md → to.md} +71 -39
tmp/tmp2duy56fb/{from.md → to.md} RENAMED
@@ -8,13 +8,13 @@ keys themselves. The `set` class supports bidirectional iterators.
8
 
9
  A `set` satisfies all of the requirements of a container, of a
10
  reversible container ([[container.requirements]]), of an associative
11
  container ([[associative.reqmts]]), and of an allocator-aware container
12
  (Table  [[tab:containers.allocatoraware]]). A `set` also provides most
13
- operations described in ([[associative.reqmts]]) for unique keys. This
14
- means that a `set` supports the `a_uniq` operations in (
15
- [[associative.reqmts]]) but not the `a_eq` operations. For a `set<Key>`
16
  both the `key_type` and `value_type` are `Key`. Descriptions are
17
  provided here only for operations on `set` that are not described in one
18
  of these tables and for operations where there is additional semantic
19
  information.
20
 
@@ -23,49 +23,51 @@ namespace std {
23
  template <class Key, class Compare = less<Key>,
24
  class Allocator = allocator<Key>>
25
  class set {
26
  public:
27
  // types:
28
- typedef Key key_type;
29
- typedef Key value_type;
30
- typedef Compare key_compare;
31
- typedef Compare value_compare;
32
- typedef Allocator allocator_type;
33
- typedef value_type& reference;
34
- typedef const value_type& const_reference;
35
- typedef implementation-defined iterator; // See [container.requirements]
36
- typedef implementation-defined const_iterator; // See [container.requirements]
37
- typedef implementation-defined size_type; // See [container.requirements]
38
- typedef implementation-defined difference_type;// See [container.requirements]
39
- typedef typename allocator_traits<Allocator>::pointer pointer;
40
- typedef typename allocator_traits<Allocator>::const_pointer const_pointer;
41
- typedef std::reverse_iterator<iterator> reverse_iterator;
42
- typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
 
 
43
 
44
- // [set.cons], construct/copy/destroy:
45
  set() : set(Compare()) { }
46
- explicit set(const Compare& comp,
47
- const Allocator& = Allocator());
48
  template <class InputIterator>
49
  set(InputIterator first, InputIterator last,
50
  const Compare& comp = Compare(), const Allocator& = Allocator());
51
  set(const set& x);
52
  set(set&& x);
53
  explicit set(const Allocator&);
54
  set(const set&, const Allocator&);
55
  set(set&&, const Allocator&);
56
- set(initializer_list<value_type>,
57
- const Compare& = Compare(),
58
  const Allocator& = Allocator());
59
  template <class InputIterator>
60
  set(InputIterator first, InputIterator last, const Allocator& a)
61
  : set(first, last, Compare(), a) { }
62
  set(initializer_list<value_type> il, const Allocator& a)
63
  : set(il, Compare(), a) { }
64
  ~set();
65
  set& operator=(const set& x);
66
- set& operator=(set&& x);
 
 
67
  set& operator=(initializer_list<value_type>);
68
  allocator_type get_allocator() const noexcept;
69
 
70
  // iterators:
71
  iterator begin() noexcept;
@@ -97,16 +99,33 @@ namespace std {
97
  iterator insert(const_iterator position, value_type&& x);
98
  template <class InputIterator>
99
  void insert(InputIterator first, InputIterator last);
100
  void insert(initializer_list<value_type>);
101
 
 
 
 
 
 
 
102
  iterator erase(const_iterator position);
103
  size_type erase(const key_type& x);
104
  iterator erase(const_iterator first, const_iterator last);
105
- void swap(set&);
 
 
106
  void clear() noexcept;
107
 
 
 
 
 
 
 
 
 
 
108
  // observers:
109
  key_compare key_comp() const;
110
  value_compare value_comp() const;
111
 
112
  // set operations:
@@ -134,10 +153,29 @@ namespace std {
134
  pair<iterator, iterator> equal_range(const K& x);
135
  template <class K>
136
  pair<const_iterator, const_iterator> equal_range(const K& x) const;
137
  };
138
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
139
  template <class Key, class Compare, class Allocator>
140
  bool operator==(const set<Key, Compare, Allocator>& x,
141
  const set<Key, Compare, Allocator>& y);
142
  template <class Key, class Compare, class Allocator>
143
  bool operator< (const set<Key, Compare, Allocator>& x,
@@ -153,25 +191,25 @@ namespace std {
153
  const set<Key, Compare, Allocator>& y);
154
  template <class Key, class Compare, class Allocator>
155
  bool operator<=(const set<Key, Compare, Allocator>& x,
156
  const set<Key, Compare, Allocator>& y);
157
 
158
- // specialized algorithms:
159
  template <class Key, class Compare, class Allocator>
160
  void swap(set<Key, Compare, Allocator>& x,
161
- set<Key,Compare,Allocator>& y);
 
162
  }
163
  ```
164
 
165
  #### `set` constructors, copy, and assignment <a id="set.cons">[[set.cons]]</a>
166
 
167
  ``` cpp
168
- explicit set(const Compare& comp,
169
- const Allocator& = Allocator());
170
  ```
171
 
172
- *Effects:* Constructs an empty set using the specified comparison
173
  objects and allocator.
174
 
175
  *Complexity:* Constant.
176
 
177
  ``` cpp
@@ -182,25 +220,19 @@ template <class InputIterator>
182
 
183
  *Effects:* Constructs an empty `set` using the specified comparison
184
  object and allocator, and inserts elements from the range \[`first`,
185
  `last`).
186
 
187
- *Requires:* If the iterator’s indirection operator returns an lvalue or
188
- a non-const rvalue, then `Key` shall be `CopyInsertable` into `*this`.
189
-
190
  *Complexity:* Linear in N if the range \[`first`, `last`) is already
191
  sorted using `comp` and otherwise N log N, where N is `last - first`.
192
 
193
  #### `set` specialized algorithms <a id="set.special">[[set.special]]</a>
194
 
195
  ``` cpp
196
  template <class Key, class Compare, class Allocator>
197
  void swap(set<Key, Compare, Allocator>& x,
198
- set<Key,Compare,Allocator>& y);
 
199
  ```
200
 
201
- *Effects:*
202
-
203
- ``` cpp
204
- x.swap(y);
205
- ```
206
 
 
8
 
9
  A `set` satisfies all of the requirements of a container, of a
10
  reversible container ([[container.requirements]]), of an associative
11
  container ([[associative.reqmts]]), and of an allocator-aware container
12
  (Table  [[tab:containers.allocatoraware]]). A `set` also provides most
13
+ operations described in  [[associative.reqmts]] for unique keys. This
14
+ means that a `set` supports the `a_uniq` operations in 
15
+ [[associative.reqmts]] but not the `a_eq` operations. For a `set<Key>`
16
  both the `key_type` and `value_type` are `Key`. Descriptions are
17
  provided here only for operations on `set` that are not described in one
18
  of these tables and for operations where there is additional semantic
19
  information.
20
 
 
23
  template <class Key, class Compare = less<Key>,
24
  class Allocator = allocator<Key>>
25
  class set {
26
  public:
27
  // types:
28
+ using key_type = Key;
29
+ using key_compare = Compare;
30
+ using value_type = Key;
31
+ using value_compare = Compare;
32
+ using allocator_type = Allocator;
33
+ using pointer = typename allocator_traits<Allocator>::pointer;
34
+ using const_pointer = typename allocator_traits<Allocator>::const_pointer;
35
+ using reference = value_type&;
36
+ using const_reference = const value_type&;
37
+ using size_type = implementation-defined; // see [container.requirements]
38
+ using difference_type = implementation-defined; // see [container.requirements]
39
+ using iterator = implementation-defined // type of set::iterator; // see [container.requirements]
40
+ using const_iterator = implementation-defined // type of set::const_iterator; // see [container.requirements]
41
+ using reverse_iterator = std::reverse_iterator<iterator>;
42
+ using const_reverse_iterator = std::reverse_iterator<const_iterator>;
43
+ using node_type = unspecified;
44
+ using insert_return_type = INSERT_RETURN_TYPE<iterator, node_type>;
45
 
46
+ // [set.cons], construct/copy/destroy
47
  set() : set(Compare()) { }
48
+ explicit set(const Compare& comp, const Allocator& = Allocator());
 
49
  template <class InputIterator>
50
  set(InputIterator first, InputIterator last,
51
  const Compare& comp = Compare(), const Allocator& = Allocator());
52
  set(const set& x);
53
  set(set&& x);
54
  explicit set(const Allocator&);
55
  set(const set&, const Allocator&);
56
  set(set&&, const Allocator&);
57
+ set(initializer_list<value_type>, const Compare& = Compare(),
 
58
  const Allocator& = Allocator());
59
  template <class InputIterator>
60
  set(InputIterator first, InputIterator last, const Allocator& a)
61
  : set(first, last, Compare(), a) { }
62
  set(initializer_list<value_type> il, const Allocator& a)
63
  : set(il, Compare(), a) { }
64
  ~set();
65
  set& operator=(const set& x);
66
+ set& operator=(set&& x)
67
+ noexcept(allocator_traits<Allocator>::is_always_equal::value &&
68
+ is_nothrow_move_assignable_v<Compare>);
69
  set& operator=(initializer_list<value_type>);
70
  allocator_type get_allocator() const noexcept;
71
 
72
  // iterators:
73
  iterator begin() noexcept;
 
99
  iterator insert(const_iterator position, value_type&& x);
100
  template <class InputIterator>
101
  void insert(InputIterator first, InputIterator last);
102
  void insert(initializer_list<value_type>);
103
 
104
+ node_type extract(const_iterator position);
105
+ node_type extract(const key_type& x);
106
+ insert_return_type insert(node_type&& nh);
107
+ iterator insert(const_iterator hint, node_type&& nh);
108
+
109
+ iterator erase(iterator position);
110
  iterator erase(const_iterator position);
111
  size_type erase(const key_type& x);
112
  iterator erase(const_iterator first, const_iterator last);
113
+ void swap(set&)
114
+ noexcept(allocator_traits<Allocator>::is_always_equal::value &&
115
+ is_nothrow_swappable_v<Compare>);
116
  void clear() noexcept;
117
 
118
+ template<class C2>
119
+ void merge(set<Key, C2, Allocator>& source);
120
+ template<class C2>
121
+ void merge(set<Key, C2, Allocator>&& source);
122
+ template<class C2>
123
+ void merge(multiset<Key, C2, Allocator>& source);
124
+ template<class C2>
125
+ void merge(multiset<Key, C2, Allocator>&& source);
126
+
127
  // observers:
128
  key_compare key_comp() const;
129
  value_compare value_comp() const;
130
 
131
  // set operations:
 
153
  pair<iterator, iterator> equal_range(const K& x);
154
  template <class K>
155
  pair<const_iterator, const_iterator> equal_range(const K& x) const;
156
  };
157
 
158
+ template<class InputIterator,
159
+ class Compare = less<typename iterator_traits<InputIterator>::value_type>,
160
+ class Allocator = allocator<typename iterator_traits<InputIterator>::value_type>>
161
+ set(InputIterator, InputIterator,
162
+ Compare = Compare(), Allocator = Allocator())
163
+ -> set<typename iterator_traits<InputIterator>::value_type, Compare, Allocator>;
164
+
165
+ template<class Key, class Compare = less<Key>, class Allocator = allocator<Key>>
166
+ set(initializer_list<Key>, Compare = Compare(), Allocator = Allocator())
167
+ -> set<Key, Compare, Allocator>;
168
+
169
+ template<class InputIterator, class Allocator>
170
+ set(InputIterator, InputIterator, Allocator)
171
+ -> set<typename iterator_traits<InputIterator>::value_type,
172
+ less<typename iterator_traits<InputIterator>::value_type>, Allocator>;
173
+
174
+ template<class Key, class Allocator>
175
+ set(initializer_list<Key>, Allocator) -> set<Key, less<Key>, Allocator>;
176
+
177
  template <class Key, class Compare, class Allocator>
178
  bool operator==(const set<Key, Compare, Allocator>& x,
179
  const set<Key, Compare, Allocator>& y);
180
  template <class Key, class Compare, class Allocator>
181
  bool operator< (const set<Key, Compare, Allocator>& x,
 
191
  const set<Key, Compare, Allocator>& y);
192
  template <class Key, class Compare, class Allocator>
193
  bool operator<=(const set<Key, Compare, Allocator>& x,
194
  const set<Key, Compare, Allocator>& y);
195
 
196
+ // [set.special], specialized algorithms
197
  template <class Key, class Compare, class Allocator>
198
  void swap(set<Key, Compare, Allocator>& x,
199
+ set<Key, Compare, Allocator>& y)
200
+ noexcept(noexcept(x.swap(y)));
201
  }
202
  ```
203
 
204
  #### `set` constructors, copy, and assignment <a id="set.cons">[[set.cons]]</a>
205
 
206
  ``` cpp
207
+ explicit set(const Compare& comp, const Allocator& = Allocator());
 
208
  ```
209
 
210
+ *Effects:* Constructs an empty `set` using the specified comparison
211
  objects and allocator.
212
 
213
  *Complexity:* Constant.
214
 
215
  ``` cpp
 
220
 
221
  *Effects:* Constructs an empty `set` using the specified comparison
222
  object and allocator, and inserts elements from the range \[`first`,
223
  `last`).
224
 
 
 
 
225
  *Complexity:* Linear in N if the range \[`first`, `last`) is already
226
  sorted using `comp` and otherwise N log N, where N is `last - first`.
227
 
228
  #### `set` specialized algorithms <a id="set.special">[[set.special]]</a>
229
 
230
  ``` cpp
231
  template <class Key, class Compare, class Allocator>
232
  void swap(set<Key, Compare, Allocator>& x,
233
+ set<Key, Compare, Allocator>& y)
234
+ noexcept(noexcept(x.swap(y)));
235
  ```
236
 
237
+ *Effects:* As if by `x.swap(y)`.
 
 
 
 
238