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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#### Definition <a id="flat.set.defn">[[flat.set.defn]]</a>
|
| 2 |
+
|
| 3 |
+
``` cpp
|
| 4 |
+
namespace std {
|
| 5 |
+
template<class Key, class Compare = less<Key>, class KeyContainer = vector<Key>>
|
| 6 |
+
class flat_set {
|
| 7 |
+
public:
|
| 8 |
+
// types
|
| 9 |
+
using key_type = Key;
|
| 10 |
+
using value_type = Key;
|
| 11 |
+
using key_compare = Compare;
|
| 12 |
+
using value_compare = Compare;
|
| 13 |
+
using reference = value_type&;
|
| 14 |
+
using const_reference = const value_type&;
|
| 15 |
+
using size_type = typename KeyContainer::size_type;
|
| 16 |
+
using difference_type = typename KeyContainer::difference_type;
|
| 17 |
+
using iterator = implementation-defined // type of flat_set::iterator; // see [container.requirements]
|
| 18 |
+
using const_iterator = implementation-defined // type of flat_set::const_iterator; // see [container.requirements]
|
| 19 |
+
using reverse_iterator = std::reverse_iterator<iterator>;
|
| 20 |
+
using const_reverse_iterator = std::reverse_iterator<const_iterator>;
|
| 21 |
+
using container_type = KeyContainer;
|
| 22 |
+
|
| 23 |
+
// [flat.set.cons], constructors
|
| 24 |
+
flat_set() : flat_set(key_compare()) { }
|
| 25 |
+
|
| 26 |
+
explicit flat_set(container_type cont, const key_compare& comp = key_compare());
|
| 27 |
+
template<class Allocator>
|
| 28 |
+
flat_set(const container_type& cont, const Allocator& a);
|
| 29 |
+
template<class Allocator>
|
| 30 |
+
flat_set(const container_type& cont, const key_compare& comp, const Allocator& a);
|
| 31 |
+
|
| 32 |
+
flat_set(sorted_unique_t, container_type cont, const key_compare& comp = key_compare())
|
| 33 |
+
: c(std::move(cont)), compare(comp) { }
|
| 34 |
+
template<class Allocator>
|
| 35 |
+
flat_set(sorted_unique_t, const container_type& cont, const Allocator& a);
|
| 36 |
+
template<class Allocator>
|
| 37 |
+
flat_set(sorted_unique_t, const container_type& cont,
|
| 38 |
+
const key_compare& comp, const Allocator& a);
|
| 39 |
+
|
| 40 |
+
explicit flat_set(const key_compare& comp)
|
| 41 |
+
: c(), compare(comp) { }
|
| 42 |
+
template<class Allocator>
|
| 43 |
+
flat_set(const key_compare& comp, const Allocator& a);
|
| 44 |
+
template<class Allocator>
|
| 45 |
+
explicit flat_set(const Allocator& a);
|
| 46 |
+
|
| 47 |
+
template<class InputIterator>
|
| 48 |
+
flat_set(InputIterator first, InputIterator last, const key_compare& comp = key_compare())
|
| 49 |
+
: c(), compare(comp)
|
| 50 |
+
{ insert(first, last); }
|
| 51 |
+
template<class InputIterator, class Allocator>
|
| 52 |
+
flat_set(InputIterator first, InputIterator last,
|
| 53 |
+
const key_compare& comp, const Allocator& a);
|
| 54 |
+
template<class InputIterator, class Allocator>
|
| 55 |
+
flat_set(InputIterator first, InputIterator last, const Allocator& a);
|
| 56 |
+
|
| 57 |
+
template<container-compatible-range<value_type> R>
|
| 58 |
+
flat_set(from_range_t fr, R&& rg)
|
| 59 |
+
: flat_set(fr, std::forward<R>(rg), key_compare()) { }
|
| 60 |
+
template<container-compatible-range<value_type> R, class Allocator>
|
| 61 |
+
flat_set(from_range_t, R&& rg, const Allocator& a);
|
| 62 |
+
template<container-compatible-range<value_type> R>
|
| 63 |
+
flat_set(from_range_t, R&& rg, const key_compare& comp)
|
| 64 |
+
: flat_set(comp)
|
| 65 |
+
{ insert_range(std::forward<R>(rg)); }
|
| 66 |
+
template<container-compatible-range<value_type> R, class Allocator>
|
| 67 |
+
flat_set(from_range_t, R&& rg, const key_compare& comp, const Allocator& a);
|
| 68 |
+
|
| 69 |
+
template<class InputIterator>
|
| 70 |
+
flat_set(sorted_unique_t, InputIterator first, InputIterator last,
|
| 71 |
+
const key_compare& comp = key_compare())
|
| 72 |
+
: c(first, last), compare(comp) { }
|
| 73 |
+
template<class InputIterator, class Allocator>
|
| 74 |
+
flat_set(sorted_unique_t, InputIterator first, InputIterator last,
|
| 75 |
+
const key_compare& comp, const Allocator& a);
|
| 76 |
+
template<class InputIterator, class Allocator>
|
| 77 |
+
flat_set(sorted_unique_t, InputIterator first, InputIterator last, const Allocator& a);
|
| 78 |
+
|
| 79 |
+
flat_set(initializer_list<value_type> il, const key_compare& comp = key_compare())
|
| 80 |
+
: flat_set(il.begin(), il.end(), comp) { }
|
| 81 |
+
template<class Allocator>
|
| 82 |
+
flat_set(initializer_list<value_type> il, const key_compare& comp, const Allocator& a);
|
| 83 |
+
template<class Allocator>
|
| 84 |
+
flat_set(initializer_list<value_type> il, const Allocator& a);
|
| 85 |
+
|
| 86 |
+
flat_set(sorted_unique_t s, initializer_list<value_type> il,
|
| 87 |
+
const key_compare& comp = key_compare())
|
| 88 |
+
: flat_set(s, il.begin(), il.end(), comp) { }
|
| 89 |
+
template<class Allocator>
|
| 90 |
+
flat_set(sorted_unique_t, initializer_list<value_type> il,
|
| 91 |
+
const key_compare& comp, const Allocator& a);
|
| 92 |
+
template<class Allocator>
|
| 93 |
+
flat_set(sorted_unique_t, initializer_list<value_type> il, const Allocator& a);
|
| 94 |
+
|
| 95 |
+
flat_set& operator=(initializer_list<value_type>);
|
| 96 |
+
|
| 97 |
+
// iterators
|
| 98 |
+
iterator begin() noexcept;
|
| 99 |
+
const_iterator begin() const noexcept;
|
| 100 |
+
iterator end() noexcept;
|
| 101 |
+
const_iterator end() const noexcept;
|
| 102 |
+
|
| 103 |
+
reverse_iterator rbegin() noexcept;
|
| 104 |
+
const_reverse_iterator rbegin() const noexcept;
|
| 105 |
+
reverse_iterator rend() noexcept;
|
| 106 |
+
const_reverse_iterator rend() const noexcept;
|
| 107 |
+
|
| 108 |
+
const_iterator cbegin() const noexcept;
|
| 109 |
+
const_iterator cend() const noexcept;
|
| 110 |
+
const_reverse_iterator crbegin() const noexcept;
|
| 111 |
+
const_reverse_iterator crend() const noexcept;
|
| 112 |
+
|
| 113 |
+
// capacity
|
| 114 |
+
[[nodiscard]] bool empty() const noexcept;
|
| 115 |
+
size_type size() const noexcept;
|
| 116 |
+
size_type max_size() const noexcept;
|
| 117 |
+
|
| 118 |
+
// [flat.set.modifiers], modifiers
|
| 119 |
+
template<class... Args> pair<iterator, bool> emplace(Args&&... args);
|
| 120 |
+
template<class... Args>
|
| 121 |
+
iterator emplace_hint(const_iterator position, Args&&... args);
|
| 122 |
+
|
| 123 |
+
pair<iterator, bool> insert(const value_type& x)
|
| 124 |
+
{ return emplace(x); }
|
| 125 |
+
pair<iterator, bool> insert(value_type&& x)
|
| 126 |
+
{ return emplace(std::move(x)); }
|
| 127 |
+
template<class K> pair<iterator, bool> insert(K&& x);
|
| 128 |
+
iterator insert(const_iterator position, const value_type& x)
|
| 129 |
+
{ return emplace_hint(position, x); }
|
| 130 |
+
iterator insert(const_iterator position, value_type&& x)
|
| 131 |
+
{ return emplace_hint(position, std::move(x)); }
|
| 132 |
+
template<class K> iterator insert(const_iterator hint, K&& x);
|
| 133 |
+
|
| 134 |
+
template<class InputIterator>
|
| 135 |
+
void insert(InputIterator first, InputIterator last);
|
| 136 |
+
template<class InputIterator>
|
| 137 |
+
void insert(sorted_unique_t, InputIterator first, InputIterator last);
|
| 138 |
+
template<container-compatible-range<value_type> R>
|
| 139 |
+
void insert_range(R&& rg);
|
| 140 |
+
|
| 141 |
+
void insert(initializer_list<value_type> il)
|
| 142 |
+
{ insert(il.begin(), il.end()); }
|
| 143 |
+
void insert(sorted_unique_t s, initializer_list<value_type> il)
|
| 144 |
+
{ insert(s, il.begin(), il.end()); }
|
| 145 |
+
|
| 146 |
+
container_type extract() &&;
|
| 147 |
+
void replace(container_type&&);
|
| 148 |
+
|
| 149 |
+
iterator erase(iterator position);
|
| 150 |
+
iterator erase(const_iterator position);
|
| 151 |
+
size_type erase(const key_type& x);
|
| 152 |
+
template<class K> size_type erase(K&& x);
|
| 153 |
+
iterator erase(const_iterator first, const_iterator last);
|
| 154 |
+
|
| 155 |
+
void swap(flat_set& y) noexcept;
|
| 156 |
+
void clear() noexcept;
|
| 157 |
+
|
| 158 |
+
// observers
|
| 159 |
+
key_compare key_comp() const;
|
| 160 |
+
value_compare value_comp() const;
|
| 161 |
+
|
| 162 |
+
// set operations
|
| 163 |
+
iterator find(const key_type& x);
|
| 164 |
+
const_iterator find(const key_type& x) const;
|
| 165 |
+
template<class K> iterator find(const K& x);
|
| 166 |
+
template<class K> const_iterator find(const K& x) const;
|
| 167 |
+
|
| 168 |
+
size_type count(const key_type& x) const;
|
| 169 |
+
template<class K> size_type count(const K& x) const;
|
| 170 |
+
|
| 171 |
+
bool contains(const key_type& x) const;
|
| 172 |
+
template<class K> bool contains(const K& x) const;
|
| 173 |
+
|
| 174 |
+
iterator lower_bound(const key_type& x);
|
| 175 |
+
const_iterator lower_bound(const key_type& x) const;
|
| 176 |
+
template<class K> iterator lower_bound(const K& x);
|
| 177 |
+
template<class K> const_iterator lower_bound(const K& x) const;
|
| 178 |
+
|
| 179 |
+
iterator upper_bound(const key_type& x);
|
| 180 |
+
const_iterator upper_bound(const key_type& x) const;
|
| 181 |
+
template<class K> iterator upper_bound(const K& x);
|
| 182 |
+
template<class K> const_iterator upper_bound(const K& x) const;
|
| 183 |
+
|
| 184 |
+
pair<iterator, iterator> equal_range(const key_type& x);
|
| 185 |
+
pair<const_iterator, const_iterator> equal_range(const key_type& x) const;
|
| 186 |
+
template<class K>
|
| 187 |
+
pair<iterator, iterator> equal_range(const K& x);
|
| 188 |
+
template<class K>
|
| 189 |
+
pair<const_iterator, const_iterator> equal_range(const K& x) const;
|
| 190 |
+
|
| 191 |
+
friend bool operator==(const flat_set& x, const flat_set& y);
|
| 192 |
+
|
| 193 |
+
friend synth-three-way-result<value_type>
|
| 194 |
+
operator<=>(const flat_set& x, const flat_set& y);
|
| 195 |
+
|
| 196 |
+
friend void swap(flat_set& x, flat_set& y) noexcept { x.swap(y); }
|
| 197 |
+
|
| 198 |
+
private:
|
| 199 |
+
container_type c; // exposition only
|
| 200 |
+
key_compare compare; // exposition only
|
| 201 |
+
};
|
| 202 |
+
|
| 203 |
+
template<class KeyContainer, class Compare = less<typename KeyContainer::value_type>>
|
| 204 |
+
flat_set(KeyContainer, Compare = Compare())
|
| 205 |
+
-> flat_set<typename KeyContainer::value_type, Compare, KeyContainer>;
|
| 206 |
+
template<class KeyContainer, class Allocator>
|
| 207 |
+
flat_set(KeyContainer, Allocator)
|
| 208 |
+
-> flat_set<typename KeyContainer::value_type,
|
| 209 |
+
less<typename KeyContainer::value_type>, KeyContainer>;
|
| 210 |
+
template<class KeyContainer, class Compare, class Allocator>
|
| 211 |
+
flat_set(KeyContainer, Compare, Allocator)
|
| 212 |
+
-> flat_set<typename KeyContainer::value_type, Compare, KeyContainer>;
|
| 213 |
+
|
| 214 |
+
template<class KeyContainer, class Compare = less<typename KeyContainer::value_type>>
|
| 215 |
+
flat_set(sorted_unique_t, KeyContainer, Compare = Compare())
|
| 216 |
+
-> flat_set<typename KeyContainer::value_type, Compare, KeyContainer>;
|
| 217 |
+
template<class KeyContainer, class Allocator>
|
| 218 |
+
flat_set(sorted_unique_t, KeyContainer, Allocator)
|
| 219 |
+
-> flat_set<typename KeyContainer::value_type,
|
| 220 |
+
less<typename KeyContainer::value_type>, KeyContainer>;
|
| 221 |
+
template<class KeyContainer, class Compare, class Allocator>
|
| 222 |
+
flat_set(sorted_unique_t, KeyContainer, Compare, Allocator)
|
| 223 |
+
-> flat_set<typename KeyContainer::value_type, Compare, KeyContainer>;
|
| 224 |
+
|
| 225 |
+
template<class InputIterator, class Compare = less<iter-value-type<InputIterator>>>
|
| 226 |
+
flat_set(InputIterator, InputIterator, Compare = Compare())
|
| 227 |
+
-> flat_set<iter-value-type<InputIterator>, Compare>;
|
| 228 |
+
|
| 229 |
+
template<class InputIterator, class Compare = less<iter-value-type<InputIterator>>>
|
| 230 |
+
flat_set(sorted_unique_t, InputIterator, InputIterator, Compare = Compare())
|
| 231 |
+
-> flat_set<iter-value-type<InputIterator>, Compare>;
|
| 232 |
+
|
| 233 |
+
template<ranges::input_range R, class Compare = less<ranges::range_value_t<R>>,
|
| 234 |
+
class Allocator = allocator<ranges::range_value_t<R>>>
|
| 235 |
+
flat_set(from_range_t, R&&, Compare = Compare(), Allocator = Allocator())
|
| 236 |
+
-> flat_set<ranges::range_value_t<R>, Compare,
|
| 237 |
+
vector<ranges::range_value_t<R>,
|
| 238 |
+
alloc-rebind<Allocator, ranges::range_value_t<R>>>>;
|
| 239 |
+
|
| 240 |
+
template<ranges::input_range R, class Allocator>
|
| 241 |
+
flat_set(from_range_t, R&&, Allocator)
|
| 242 |
+
-> flat_set<ranges::range_value_t<R>, less<ranges::range_value_t<R>>,
|
| 243 |
+
vector<ranges::range_value_t<R>,
|
| 244 |
+
alloc-rebind<Allocator, ranges::range_value_t<R>>>>;
|
| 245 |
+
|
| 246 |
+
template<class Key, class Compare = less<Key>>
|
| 247 |
+
flat_set(initializer_list<Key>, Compare = Compare())
|
| 248 |
+
-> flat_set<Key, Compare>;
|
| 249 |
+
|
| 250 |
+
template<class Key, class Compare = less<Key>>
|
| 251 |
+
flat_set(sorted_unique_t, initializer_list<Key>, Compare = Compare())
|
| 252 |
+
-> flat_set<Key, Compare>;
|
| 253 |
+
|
| 254 |
+
template<class Key, class Compare, class KeyContainer, class Allocator>
|
| 255 |
+
struct uses_allocator<flat_set<Key, Compare, KeyContainer>, Allocator>
|
| 256 |
+
: bool_constant<uses_allocator_v<KeyContainer, Allocator>> { };
|
| 257 |
+
}
|
| 258 |
+
```
|
| 259 |
+
|