tmp/tmpq13fv2cr/{from.md → to.md}
RENAMED
|
@@ -6,13 +6,13 @@ keys themselves. The `set` class supports bidirectional iterators.
|
|
| 6 |
|
| 7 |
A `set` satisfies all of the requirements of a container, of a
|
| 8 |
reversible container ([[container.requirements]]), of an associative
|
| 9 |
container ([[associative.reqmts]]), and of an allocator-aware container
|
| 10 |
(Table [[tab:containers.allocatoraware]]). A `set` also provides most
|
| 11 |
-
operations described in
|
| 12 |
-
means that a `set` supports the `a_uniq` operations in
|
| 13 |
-
[[associative.reqmts]]
|
| 14 |
both the `key_type` and `value_type` are `Key`. Descriptions are
|
| 15 |
provided here only for operations on `set` that are not described in one
|
| 16 |
of these tables and for operations where there is additional semantic
|
| 17 |
information.
|
| 18 |
|
|
@@ -21,49 +21,51 @@ namespace std {
|
|
| 21 |
template <class Key, class Compare = less<Key>,
|
| 22 |
class Allocator = allocator<Key>>
|
| 23 |
class set {
|
| 24 |
public:
|
| 25 |
// types:
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
|
|
|
|
|
|
| 41 |
|
| 42 |
-
// [set.cons], construct/copy/destroy
|
| 43 |
set() : set(Compare()) { }
|
| 44 |
-
explicit set(const Compare& comp,
|
| 45 |
-
const Allocator& = Allocator());
|
| 46 |
template <class InputIterator>
|
| 47 |
set(InputIterator first, InputIterator last,
|
| 48 |
const Compare& comp = Compare(), const Allocator& = Allocator());
|
| 49 |
set(const set& x);
|
| 50 |
set(set&& x);
|
| 51 |
explicit set(const Allocator&);
|
| 52 |
set(const set&, const Allocator&);
|
| 53 |
set(set&&, const Allocator&);
|
| 54 |
-
set(initializer_list<value_type>,
|
| 55 |
-
const Compare& = Compare(),
|
| 56 |
const Allocator& = Allocator());
|
| 57 |
template <class InputIterator>
|
| 58 |
set(InputIterator first, InputIterator last, const Allocator& a)
|
| 59 |
: set(first, last, Compare(), a) { }
|
| 60 |
set(initializer_list<value_type> il, const Allocator& a)
|
| 61 |
: set(il, Compare(), a) { }
|
| 62 |
~set();
|
| 63 |
set& operator=(const set& x);
|
| 64 |
-
set& operator=(set&& x)
|
|
|
|
|
|
|
| 65 |
set& operator=(initializer_list<value_type>);
|
| 66 |
allocator_type get_allocator() const noexcept;
|
| 67 |
|
| 68 |
// iterators:
|
| 69 |
iterator begin() noexcept;
|
|
@@ -95,16 +97,33 @@ namespace std {
|
|
| 95 |
iterator insert(const_iterator position, value_type&& x);
|
| 96 |
template <class InputIterator>
|
| 97 |
void insert(InputIterator first, InputIterator last);
|
| 98 |
void insert(initializer_list<value_type>);
|
| 99 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 100 |
iterator erase(const_iterator position);
|
| 101 |
size_type erase(const key_type& x);
|
| 102 |
iterator erase(const_iterator first, const_iterator last);
|
| 103 |
-
void
|
|
|
|
|
|
|
| 104 |
void clear() noexcept;
|
| 105 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 106 |
// observers:
|
| 107 |
key_compare key_comp() const;
|
| 108 |
value_compare value_comp() const;
|
| 109 |
|
| 110 |
// set operations:
|
|
@@ -132,10 +151,29 @@ namespace std {
|
|
| 132 |
pair<iterator, iterator> equal_range(const K& x);
|
| 133 |
template <class K>
|
| 134 |
pair<const_iterator, const_iterator> equal_range(const K& x) const;
|
| 135 |
};
|
| 136 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 137 |
template <class Key, class Compare, class Allocator>
|
| 138 |
bool operator==(const set<Key, Compare, Allocator>& x,
|
| 139 |
const set<Key, Compare, Allocator>& y);
|
| 140 |
template <class Key, class Compare, class Allocator>
|
| 141 |
bool operator< (const set<Key, Compare, Allocator>& x,
|
|
@@ -151,12 +189,13 @@ namespace std {
|
|
| 151 |
const set<Key, Compare, Allocator>& y);
|
| 152 |
template <class Key, class Compare, class Allocator>
|
| 153 |
bool operator<=(const set<Key, Compare, Allocator>& x,
|
| 154 |
const set<Key, Compare, Allocator>& y);
|
| 155 |
|
| 156 |
-
// specialized algorithms
|
| 157 |
template <class Key, class Compare, class Allocator>
|
| 158 |
void swap(set<Key, Compare, Allocator>& x,
|
| 159 |
-
set<Key,Compare,Allocator>& y)
|
|
|
|
| 160 |
}
|
| 161 |
```
|
| 162 |
|
|
|
|
| 6 |
|
| 7 |
A `set` satisfies all of the requirements of a container, of a
|
| 8 |
reversible container ([[container.requirements]]), of an associative
|
| 9 |
container ([[associative.reqmts]]), and of an allocator-aware container
|
| 10 |
(Table [[tab:containers.allocatoraware]]). A `set` also provides most
|
| 11 |
+
operations described in [[associative.reqmts]] for unique keys. This
|
| 12 |
+
means that a `set` supports the `a_uniq` operations in
|
| 13 |
+
[[associative.reqmts]] but not the `a_eq` operations. For a `set<Key>`
|
| 14 |
both the `key_type` and `value_type` are `Key`. Descriptions are
|
| 15 |
provided here only for operations on `set` that are not described in one
|
| 16 |
of these tables and for operations where there is additional semantic
|
| 17 |
information.
|
| 18 |
|
|
|
|
| 21 |
template <class Key, class Compare = less<Key>,
|
| 22 |
class Allocator = allocator<Key>>
|
| 23 |
class set {
|
| 24 |
public:
|
| 25 |
// types:
|
| 26 |
+
using key_type = Key;
|
| 27 |
+
using key_compare = Compare;
|
| 28 |
+
using value_type = Key;
|
| 29 |
+
using value_compare = Compare;
|
| 30 |
+
using allocator_type = Allocator;
|
| 31 |
+
using pointer = typename allocator_traits<Allocator>::pointer;
|
| 32 |
+
using const_pointer = typename allocator_traits<Allocator>::const_pointer;
|
| 33 |
+
using reference = value_type&;
|
| 34 |
+
using const_reference = const value_type&;
|
| 35 |
+
using size_type = implementation-defined; // see [container.requirements]
|
| 36 |
+
using difference_type = implementation-defined; // see [container.requirements]
|
| 37 |
+
using iterator = implementation-defined // type of set::iterator; // see [container.requirements]
|
| 38 |
+
using const_iterator = implementation-defined // type of set::const_iterator; // see [container.requirements]
|
| 39 |
+
using reverse_iterator = std::reverse_iterator<iterator>;
|
| 40 |
+
using const_reverse_iterator = std::reverse_iterator<const_iterator>;
|
| 41 |
+
using node_type = unspecified;
|
| 42 |
+
using insert_return_type = INSERT_RETURN_TYPE<iterator, node_type>;
|
| 43 |
|
| 44 |
+
// [set.cons], construct/copy/destroy
|
| 45 |
set() : set(Compare()) { }
|
| 46 |
+
explicit set(const Compare& comp, const Allocator& = Allocator());
|
|
|
|
| 47 |
template <class InputIterator>
|
| 48 |
set(InputIterator first, InputIterator last,
|
| 49 |
const Compare& comp = Compare(), const Allocator& = Allocator());
|
| 50 |
set(const set& x);
|
| 51 |
set(set&& x);
|
| 52 |
explicit set(const Allocator&);
|
| 53 |
set(const set&, const Allocator&);
|
| 54 |
set(set&&, const Allocator&);
|
| 55 |
+
set(initializer_list<value_type>, const Compare& = Compare(),
|
|
|
|
| 56 |
const Allocator& = Allocator());
|
| 57 |
template <class InputIterator>
|
| 58 |
set(InputIterator first, InputIterator last, const Allocator& a)
|
| 59 |
: set(first, last, Compare(), a) { }
|
| 60 |
set(initializer_list<value_type> il, const Allocator& a)
|
| 61 |
: set(il, Compare(), a) { }
|
| 62 |
~set();
|
| 63 |
set& operator=(const set& x);
|
| 64 |
+
set& operator=(set&& x)
|
| 65 |
+
noexcept(allocator_traits<Allocator>::is_always_equal::value &&
|
| 66 |
+
is_nothrow_move_assignable_v<Compare>);
|
| 67 |
set& operator=(initializer_list<value_type>);
|
| 68 |
allocator_type get_allocator() const noexcept;
|
| 69 |
|
| 70 |
// iterators:
|
| 71 |
iterator begin() noexcept;
|
|
|
|
| 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 |
+
node_type extract(const_iterator position);
|
| 103 |
+
node_type extract(const key_type& x);
|
| 104 |
+
insert_return_type insert(node_type&& nh);
|
| 105 |
+
iterator insert(const_iterator hint, node_type&& nh);
|
| 106 |
+
|
| 107 |
+
iterator erase(iterator position);
|
| 108 |
iterator erase(const_iterator position);
|
| 109 |
size_type erase(const key_type& x);
|
| 110 |
iterator erase(const_iterator first, const_iterator last);
|
| 111 |
+
void swap(set&)
|
| 112 |
+
noexcept(allocator_traits<Allocator>::is_always_equal::value &&
|
| 113 |
+
is_nothrow_swappable_v<Compare>);
|
| 114 |
void clear() noexcept;
|
| 115 |
|
| 116 |
+
template<class C2>
|
| 117 |
+
void merge(set<Key, C2, Allocator>& source);
|
| 118 |
+
template<class C2>
|
| 119 |
+
void merge(set<Key, C2, Allocator>&& source);
|
| 120 |
+
template<class C2>
|
| 121 |
+
void merge(multiset<Key, C2, Allocator>& source);
|
| 122 |
+
template<class C2>
|
| 123 |
+
void merge(multiset<Key, C2, Allocator>&& source);
|
| 124 |
+
|
| 125 |
// observers:
|
| 126 |
key_compare key_comp() const;
|
| 127 |
value_compare value_comp() const;
|
| 128 |
|
| 129 |
// set operations:
|
|
|
|
| 151 |
pair<iterator, iterator> equal_range(const K& x);
|
| 152 |
template <class K>
|
| 153 |
pair<const_iterator, const_iterator> equal_range(const K& x) const;
|
| 154 |
};
|
| 155 |
|
| 156 |
+
template<class InputIterator,
|
| 157 |
+
class Compare = less<typename iterator_traits<InputIterator>::value_type>,
|
| 158 |
+
class Allocator = allocator<typename iterator_traits<InputIterator>::value_type>>
|
| 159 |
+
set(InputIterator, InputIterator,
|
| 160 |
+
Compare = Compare(), Allocator = Allocator())
|
| 161 |
+
-> set<typename iterator_traits<InputIterator>::value_type, Compare, Allocator>;
|
| 162 |
+
|
| 163 |
+
template<class Key, class Compare = less<Key>, class Allocator = allocator<Key>>
|
| 164 |
+
set(initializer_list<Key>, Compare = Compare(), Allocator = Allocator())
|
| 165 |
+
-> set<Key, Compare, Allocator>;
|
| 166 |
+
|
| 167 |
+
template<class InputIterator, class Allocator>
|
| 168 |
+
set(InputIterator, InputIterator, Allocator)
|
| 169 |
+
-> set<typename iterator_traits<InputIterator>::value_type,
|
| 170 |
+
less<typename iterator_traits<InputIterator>::value_type>, Allocator>;
|
| 171 |
+
|
| 172 |
+
template<class Key, class Allocator>
|
| 173 |
+
set(initializer_list<Key>, Allocator) -> set<Key, less<Key>, Allocator>;
|
| 174 |
+
|
| 175 |
template <class Key, class Compare, class Allocator>
|
| 176 |
bool operator==(const set<Key, Compare, Allocator>& x,
|
| 177 |
const set<Key, Compare, Allocator>& y);
|
| 178 |
template <class Key, class Compare, class Allocator>
|
| 179 |
bool operator< (const set<Key, Compare, Allocator>& x,
|
|
|
|
| 189 |
const set<Key, Compare, Allocator>& y);
|
| 190 |
template <class Key, class Compare, class Allocator>
|
| 191 |
bool operator<=(const set<Key, Compare, Allocator>& x,
|
| 192 |
const set<Key, Compare, Allocator>& y);
|
| 193 |
|
| 194 |
+
// [set.special], specialized algorithms
|
| 195 |
template <class Key, class Compare, class Allocator>
|
| 196 |
void swap(set<Key, Compare, Allocator>& x,
|
| 197 |
+
set<Key, Compare, Allocator>& y)
|
| 198 |
+
noexcept(noexcept(x.swap(y)));
|
| 199 |
}
|
| 200 |
```
|
| 201 |
|