tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
static_set.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSL-1.0
2
3#ifndef TETL_SET_STATIC_SET_HPP
4#define TETL_SET_STATIC_SET_HPP
5
13#include <etl/_iterator/end.hpp>
19
20namespace etl {
21
28template <typename Key, size_t Capacity, typename Compare = less<Key>>
29struct static_set {
30private:
31 // TODO: Currently static_set only supports default constructible
32 // comparators. This is because storing the Compare object would take up at
33 // least 1 extra byte. Probably even more because of alignment. The fix is
34 // to create a conditional storage struct depending on if the Compare
35 // template argument can be default constructed. If so: construct it on
36 // demand. If not: store it as a member.
38
39 using storage_type = static_vector<Key, Capacity>;
40 storage_type _storage{};
41
42public:
47 using key_compare = Compare;
48 using value_compare = Compare;
57
59 constexpr static_set() = default;
60
64 template <typename InputIt>
65 requires(detail::InputIterator<InputIt>)
66 constexpr static_set(InputIt first, InputIt last)
67 {
68 if constexpr (detail::RandomAccessIterator<InputIt>) {
69 TETL_PRECONDITION(last - first >= 0);
70 TETL_PRECONDITION(static_cast<size_type>(last - first) <= max_size());
71 }
72
73 insert(first, last);
74 }
75
77 constexpr static_set(static_set const& other) = default;
78
80 constexpr static_set(static_set&& other) noexcept(noexcept(etl::move(declval<storage_type>()))) = default;
81
83 constexpr auto operator=(static_set const& other) -> static_set& = default;
84
86 constexpr auto operator=(static_set&& other) noexcept(noexcept(etl::move(declval<storage_type>())))
87 -> static_set& = default;
88
90 [[nodiscard]] constexpr auto begin() noexcept -> iterator { return _storage.begin(); }
91
93 [[nodiscard]] constexpr auto begin() const noexcept -> const_iterator { return _storage.begin(); }
94
96 [[nodiscard]] constexpr auto cbegin() const noexcept -> const_iterator { return begin(); }
97
100 [[nodiscard]] constexpr auto end() noexcept -> iterator { return _storage.end(); }
101
104 [[nodiscard]] constexpr auto end() const noexcept -> const_iterator { return _storage.end(); }
105
108 [[nodiscard]] constexpr auto cend() const noexcept -> const_iterator { return end(); }
109
112 [[nodiscard]] constexpr auto rbegin() noexcept -> reverse_iterator { return reverse_iterator(end()); }
113
116 [[nodiscard]] constexpr auto rbegin() const noexcept -> const_reverse_iterator
117 {
118 return const_reverse_iterator(end());
119 }
120
123 [[nodiscard]] constexpr auto crbegin() const noexcept -> const_reverse_iterator { return rbegin(); }
124
128 [[nodiscard]] constexpr auto rend() noexcept -> reverse_iterator { return reverse_iterator(begin()); }
129
133 [[nodiscard]] constexpr auto rend() const noexcept -> const_reverse_iterator
134 {
136 }
137
141 [[nodiscard]] constexpr auto crend() const noexcept -> const_reverse_iterator { return rend(); }
142
145 [[nodiscard]] constexpr auto empty() const noexcept -> bool { return _storage.empty(); }
146
148 [[nodiscard]] constexpr auto full() const noexcept -> bool { return _storage.full(); }
149
152 [[nodiscard]] constexpr auto size() const noexcept -> size_type { return _storage.size(); }
153
156 [[nodiscard]] constexpr auto max_size() const noexcept -> size_type { return _storage.max_size(); }
157
160 constexpr auto clear() noexcept -> void { _storage.clear(); }
161
164 constexpr auto insert(value_type&& value) -> pair<iterator, bool>
166 {
167 if (!full()) {
168 auto cmp = key_compare{};
169 auto* p = etl::lower_bound(_storage.begin(), _storage.end(), value, cmp);
170 if (p == _storage.end() || *(p) != value) {
171 _storage.push_back(etl::move(value));
172 auto* pos = rotate(p, _storage.end() - 1, _storage.end());
173 return make_pair(pos, true);
174 }
175 }
176
177 return pair<iterator, bool>(nullptr, false);
178 }
179
182 constexpr auto insert(value_type const& value) noexcept(noexcept(insert(etl::move(declval<key_type>()))))
185 {
186 value_type tmp = value;
187 return insert(etl::move(tmp));
188 }
189
193 template <typename InputIter>
194 requires(detail::InputIterator<InputIter>)
195 constexpr auto insert(InputIter first, InputIter last) noexcept(noexcept(insert(declval<key_type>()))) -> void
196 {
197 for (; first != last; ++first) {
198 insert(*first);
199 }
200 }
201
205 template <typename... Args>
207 constexpr auto emplace(Args&&... args) noexcept(noexcept(insert(declval<key_type>()))) -> pair<iterator, bool>
208 {
209 return insert(value_type(etl::forward<Args>(args)...));
210 }
211
217 constexpr auto erase(iterator pos) noexcept -> iterator { return _storage.erase(pos); }
218
225 constexpr auto erase(iterator first, iterator last) -> iterator
226 {
227 auto res = first;
228 for (; first != last; ++first) {
229 res = erase(first);
230 }
231 return res;
232 }
233
240 constexpr auto erase(key_type const& key) noexcept -> size_type
241 {
242 if (auto* pos = etl::lower_bound(begin(), end(), key); pos != end()) {
243 erase(pos);
244 return 1;
245 }
246 return 0;
247 }
248
250 constexpr auto swap(static_set& other) noexcept(is_nothrow_swappable_v<key_type>) -> void
252 {
253 etl::swap(_storage, other._storage);
254 }
255
259 [[nodiscard]] constexpr auto count(key_type const& key) const noexcept -> size_type
260 {
261 return contains(key) ? 1 : 0;
262 }
263
266 template <typename K>
267 requires(detail::is_transparent_v<key_compare>)
268 [[nodiscard]] constexpr auto count(K const& x) const -> size_type
269 {
270 return contains(x) ? 1 : 0;
271 }
272
277 [[nodiscard]] constexpr auto find(key_type const& key) noexcept -> iterator
278 {
279 return etl::find(begin(), end(), key);
280 }
281
286 [[nodiscard]] constexpr auto find(key_type const& key) const noexcept -> const_iterator
287 {
288 return etl::find(begin(), end(), key);
289 }
290
293 template <typename K>
294 requires(detail::is_transparent_v<key_compare>)
295 [[nodiscard]] constexpr auto find(K const& x) -> iterator
296 {
297 return find_if(begin(), end(), [&x](auto const& val) {
298 auto comp = key_compare();
299 return comp(val, x);
300 });
301 }
302
305 template <typename K>
306 requires(detail::is_transparent_v<key_compare>)
307 [[nodiscard]] constexpr auto find(K const& x) const -> const_iterator
308 {
309 return find_if(cbegin(), cend(), [&x](auto const& val) {
310 auto comp = key_compare();
311 return comp(val, x);
312 });
313 }
314
317 [[nodiscard]] constexpr auto contains(key_type const& key) const noexcept -> bool { return find(key) != end(); }
318
321 template <typename K>
322 requires(detail::is_transparent_v<key_compare>)
323 [[nodiscard]] constexpr auto contains(K const& x) const -> bool
324 {
325 return find(x) != end();
326 }
327
330 [[nodiscard]] constexpr auto lower_bound(key_type const& key) -> iterator
331 {
332 return etl::lower_bound(begin(), end(), key, key_compare{});
333 }
334
337 [[nodiscard]] constexpr auto lower_bound(key_type const& key) const -> const_iterator
338 {
339 return etl::lower_bound(begin(), end(), key, key_compare{});
340 }
341
344 template <typename K>
345 requires(detail::is_transparent_v<key_compare>)
346 [[nodiscard]] constexpr auto lower_bound(K const& key) -> iterator
347 {
348 return etl::lower_bound(begin(), end(), key, key_compare{});
349 }
350
353 template <typename K>
354 requires(detail::is_transparent_v<key_compare>)
355 [[nodiscard]] constexpr auto lower_bound(K const& key) const -> const_iterator
356 {
357 return etl::lower_bound(begin(), end(), key, key_compare{});
358 }
359
362 [[nodiscard]] constexpr auto upper_bound(key_type const& key) -> iterator
363 {
364 return etl::upper_bound(begin(), end(), key, key_compare{});
365 }
366
369 [[nodiscard]] constexpr auto upper_bound(key_type const& key) const -> const_iterator
370 {
371 return etl::upper_bound(begin(), end(), key, key_compare{});
372 }
373
376 template <typename K>
377 requires(detail::is_transparent_v<key_compare>)
378 [[nodiscard]] constexpr auto upper_bound(K const& key) -> iterator
379 {
380 return etl::upper_bound(begin(), end(), key, key_compare{});
381 }
382
385 template <typename K>
386 requires(detail::is_transparent_v<key_compare>)
387 [[nodiscard]] constexpr auto upper_bound(K const& key) const -> const_iterator
388 {
389 return etl::upper_bound(begin(), end(), key, key_compare{});
390 }
391
397 [[nodiscard]] constexpr auto equal_range(key_type const& key) -> iterator
398 {
399 return etl::equal_range(begin(), end(), key, key_compare{});
400 }
401
407 [[nodiscard]] constexpr auto equal_range(key_type const& key) const -> const_iterator
408 {
409 return etl::equal_range(begin(), end(), key, key_compare{});
410 }
411
417 template <typename K>
418 requires(detail::is_transparent_v<key_compare>)
419 [[nodiscard]] constexpr auto equal_range(K const& key) -> iterator
420 {
421 return etl::equal_range(begin(), end(), key, key_compare{});
422 }
423
429 template <typename K>
430 requires(detail::is_transparent_v<key_compare>)
431 [[nodiscard]] constexpr auto equal_range(K const& key) const -> const_iterator
432 {
433 return etl::equal_range(begin(), end(), key, key_compare{});
434 }
435
441 [[nodiscard]] constexpr auto key_comp() const noexcept -> key_compare { return key_compare(); }
442
447 [[nodiscard]] constexpr auto value_comp() const noexcept -> value_compare { return value_compare(); }
448};
449
455template <typename Key, size_t Capacity, typename Comp>
456[[nodiscard]] constexpr auto
458{
459 return lhs.size() == rhs.size() && equal(begin(lhs), end(lhs), begin(rhs));
460}
461
467template <typename Key, size_t Capacity, typename Comp>
468[[nodiscard]] constexpr auto
470{
471 return !(lhs == rhs);
472}
473
480template <typename Key, size_t Capacity, typename Comp>
481[[nodiscard]] constexpr auto
483{
484 return lexicographical_compare(begin(lhs), end(lhs), begin(rhs), end(rhs));
485}
486
493template <typename Key, size_t Capacity, typename Comp>
494[[nodiscard]] constexpr auto
496{
497 return !(rhs < lhs);
498}
499
506template <typename Key, size_t Capacity, typename Comp>
507[[nodiscard]] constexpr auto
509{
510 return rhs < lhs;
511}
512
519template <typename Key, size_t Capacity, typename Comp>
520[[nodiscard]] constexpr auto
522{
523 return !(lhs < rhs);
524}
525
528template <typename Key, size_t Capacity, typename Compare>
530 noexcept(noexcept(lhs.swap(rhs))) -> void
531{
532 lhs.swap(rhs);
533}
534
535// /// \brief Erases all elements that satisfy the predicate pred from the
536// container.
537// ///
538// /// https://en.cppreference.com/w/cpp/container/set/erase_if
539// template <typename Key, size_t Capacity, typename Compare, typename
540// Predicate> constexpr auto erase_if(static_set<Key, Capacity, Compare>&
541// c, Predicate pred) ->
542// typename static_set<Key, Capacity, Compare>::size_type
543// {
544// auto const old_size = c.size();
545// for (auto i = c.begin(), last = c.end(); i != last;)
546// {
547// if (pred(*i)) { i = c.erase(i); }
548// else
549// {
550// ++i;
551// }
552// }
553
554// return old_size - c.size();
555// }
556
557} // namespace etl
558
559#endif // TETL_SET_STATIC_SET_HPP
#define TETL_PRECONDITION(...)
Definition check.hpp:16
constexpr auto equal_range(ForwardIt first, ForwardIt last, T const &value, Compare comp) -> pair< ForwardIt, ForwardIt >
Returns a range containing all elements equivalent to value in the range [first, last).
Definition equal_range.hpp:20
constexpr auto find_if(InputIt first, InputIt last, Predicate pred) noexcept -> InputIt
Searches for an element for which predicate p returns true.
Definition find_if.hpp:18
constexpr auto lower_bound(ForwardIt first, ForwardIt last, T const &value, Compare comp) noexcept -> ForwardIt
Returns an iterator pointing to the first element in the range [first, last) that is not less than (i...
Definition lower_bound.hpp:21
constexpr auto move(InputIt first, InputIt last, OutputIt destination) -> OutputIt
Moves the elements in the range [first, last), to another range beginning at destination,...
Definition move.hpp:26
constexpr auto rotate(ForwardIt first, ForwardIt nFirst, ForwardIt last) -> ForwardIt
Performs a left rotation on a range of elements.
Definition rotate.hpp:17
constexpr auto lexicographical_compare(InputIt1 f1, InputIt1 l1, InputIt2 f2, InputIt2 l2, Compare comp) -> bool
Checks if the first range [f1, l1) is lexicographically less than the second range [f2,...
Definition lexicographical_compare.hpp:17
constexpr auto equal(InputIt1 first1, InputIt1 last1, InputIt2 first2, Predicate p) -> bool
Returns true if the range [first1, last1) is equal to the range [first2, first2 + (last1 - first1)),...
Definition equal.hpp:18
constexpr auto upper_bound(ForwardIt first, ForwardIt last, T const &value, Compare comp) -> ForwardIt
Returns an iterator pointing to the first element in the range [first, last) that is greater than val...
Definition upper_bound.hpp:24
constexpr auto find(InputIt first, InputIt last, T const &value) noexcept -> InputIt
Searches for an element equal to value.
Definition find.hpp:18
constexpr auto end(C &c) -> decltype(c.end())
Returns an iterator to the end (i.e. the element after the last element) of the given container c or ...
Definition end.hpp:14
constexpr auto begin(C &c) -> decltype(c.begin())
Returns an iterator to the beginning of the given container c or array array. These templates rely on...
Definition begin.hpp:20
Definition adjacent_find.hpp:8
constexpr bool is_copy_constructible_v
Definition is_copy_constructible.hpp:30
constexpr auto operator==(inplace_function< R(Args...), Capacity, Alignment > const &f, nullptr_t) noexcept -> bool
Compares a etl::inplace_function with a null pointer. Empty functions (that is, functions without a c...
Definition inplace_function.hpp:262
pair(T1, T2) -> pair< T1, T2 >
auto declval() noexcept -> add_rvalue_reference_t< T >
constexpr auto operator!=(inplace_function< R(Args...), Capacity, Alignment > const &f, nullptr_t) noexcept -> bool
Compares a etl::inplace_function with a null pointer. Empty functions (that is, functions without a c...
Definition inplace_function.hpp:272
constexpr bool is_move_constructible_v
Definition is_move_constructible.hpp:20
constexpr bool is_default_constructible_v
Definition is_default_constructible.hpp:26
constexpr bool is_assignable_v
Definition is_assignable.hpp:20
constexpr auto operator<(etl::reverse_iterator< Iter1 > const &lhs, etl::reverse_iterator< Iter2 > const &rhs) -> bool
Compares the underlying iterators. Inverse comparisons are applied in order to take into account that...
Definition reverse_iterator.hpp:167
constexpr auto make_pair(T1 &&t, T2 &&u) -> pair< decay_t< T1 >, decay_t< T2 > >
Creates a etl::pair object, deducing the target type from the types of arguments.
Definition pair.hpp:164
TETL_BUILTIN_PTRDIFF ptrdiff_t
etl::ptrdiff_t is the signed integer type of the result of subtracting two pointers.
Definition ptrdiff_t.hpp:14
constexpr auto operator<=(etl::reverse_iterator< Iter1 > const &lhs, etl::reverse_iterator< Iter2 > const &rhs) -> bool
Compares the underlying iterators. Inverse comparisons are applied in order to take into account that...
Definition reverse_iterator.hpp:177
auto swap(inplace_function< R(Args...), Capacity, Alignment > &lhs, inplace_function< R(Args...), Capacity, Alignment > &rhs) noexcept -> void
Overloads the etl::swap algorithm for etl::inplace_function. Exchanges the state of lhs with that of ...
Definition inplace_function.hpp:249
constexpr auto operator>(etl::reverse_iterator< Iter1 > const &lhs, etl::reverse_iterator< Iter2 > const &rhs) -> bool
Compares the underlying iterators. Inverse comparisons are applied in order to take into account that...
Definition reverse_iterator.hpp:185
constexpr auto operator>=(etl::reverse_iterator< Iter1 > const &lhs, etl::reverse_iterator< Iter2 > const &rhs) -> bool
Compares the underlying iterators. Inverse comparisons are applied in order to take into account that...
Definition reverse_iterator.hpp:195
constexpr auto forward(remove_reference_t< T > &param) noexcept -> T &&
Forwards lvalues as either lvalues or as rvalues, depending on T. When t is a forwarding reference (a...
Definition forward.hpp:18
TETL_BUILTIN_SIZET size_t
etl::size_t is the unsigned integer type of the result of the sizeof operator.
Definition size_t.hpp:14
constexpr bool is_nothrow_swappable_v
Definition is_nothrow_swappable.hpp:19
etl::pair is a class template that provides a way to store two heterogeneous objects as a single unit...
Definition pair.hpp:36
reverse_iterator is an iterator adaptor that reverses the direction of a given iterator....
Definition reverse_iterator.hpp:22
static_set is an associative container that contains a sorted set of unique objects of type Key....
Definition static_set.hpp:29
constexpr auto equal_range(key_type const &key) -> iterator
Returns a range containing all elements with the given key in the container. The range is defined by ...
Definition static_set.hpp:397
constexpr auto equal_range(K const &key) -> iterator
Returns a range containing all elements with the given key in the container. The range is defined by ...
Definition static_set.hpp:419
constexpr auto lower_bound(K const &key) const -> const_iterator
Returns an iterator pointing to the first element that is not less than (i.e. greater or equal to) ke...
Definition static_set.hpp:355
Compare value_compare
Definition static_set.hpp:48
constexpr auto find(key_type const &key) const noexcept -> const_iterator
Finds an element with key equivalent to key.
Definition static_set.hpp:286
typename storage_type::pointer iterator
Definition static_set.hpp:53
constexpr auto contains(key_type const &key) const noexcept -> bool
Checks if there is an element with key equivalent to key in the container.
Definition static_set.hpp:317
constexpr auto emplace(Args &&... args) noexcept(noexcept(insert(declval< key_type >()))) -> pair< iterator, bool >
Inserts a new element into the container constructed in-place with the given args if there is no elem...
Definition static_set.hpp:207
constexpr static_set(static_set &&other) noexcept(noexcept(etl::move(declval< storage_type >())))=default
constexpr auto erase(key_type const &key) noexcept -> size_type
Removes the element (if one exists) with the key equivalent to key.
Definition static_set.hpp:240
typename storage_type::value_type value_type
Definition static_set.hpp:44
constexpr auto value_comp() const noexcept -> value_compare
Returns the function object that compares the values. It is the same as key_comp.
Definition static_set.hpp:447
constexpr auto find(key_type const &key) noexcept -> iterator
Finds an element with key equivalent to key.
Definition static_set.hpp:277
Compare key_compare
Definition static_set.hpp:47
constexpr auto swap(static_set &other) noexcept(is_nothrow_swappable_v< key_type >) -> void requires(is_assignable_v< key_type &, key_type && >)
Exchanges the contents of the container with those of other.
Definition static_set.hpp:250
constexpr auto count(key_type const &key) const noexcept -> size_type
Returns the number of elements with key that compares equivalent to the specified argument,...
Definition static_set.hpp:259
constexpr auto crbegin() const noexcept -> const_reverse_iterator
Returns a reverse iterator to the first element of the reversed set. It corresponds to the last eleme...
Definition static_set.hpp:123
etl::reverse_iterator< const_iterator > const_reverse_iterator
Definition static_set.hpp:56
value_type const & const_reference
Definition static_set.hpp:50
constexpr auto upper_bound(key_type const &key) -> iterator
Returns an iterator pointing to the first element that is greater than key.
Definition static_set.hpp:362
constexpr auto upper_bound(K const &key) -> iterator
Returns an iterator pointing to the first element that is greater than key.
Definition static_set.hpp:378
constexpr auto rbegin() const noexcept -> const_reverse_iterator
Returns a reverse iterator to the first element of the reversed set. It corresponds to the last eleme...
Definition static_set.hpp:116
constexpr auto lower_bound(key_type const &key) -> iterator
Returns an iterator pointing to the first element that is not less than (i.e. greater or equal to) ke...
Definition static_set.hpp:330
constexpr auto find(K const &x) -> iterator
Finds an element with key that compares equivalent to the value x.
Definition static_set.hpp:295
typename storage_type::value_type key_type
Definition static_set.hpp:43
constexpr static_set()=default
Constructs empty container.
constexpr static_set(InputIt first, InputIt last)
Constructs with the contents of the range [first, last). If multiple elements in the range have keys ...
Definition static_set.hpp:66
constexpr auto lower_bound(key_type const &key) const -> const_iterator
Returns an iterator pointing to the first element that is not less than (i.e. greater or equal to) ke...
Definition static_set.hpp:337
constexpr auto rend() noexcept -> reverse_iterator
Returns a reverse iterator to the element following the last element of the reversed set....
Definition static_set.hpp:128
value_type & reference
Definition static_set.hpp:49
typename storage_type::pointer pointer
Definition static_set.hpp:51
constexpr auto begin() noexcept -> iterator
Returns an iterator to the first element of the set.
Definition static_set.hpp:90
constexpr auto insert(InputIter first, InputIter last) noexcept(noexcept(insert(declval< key_type >()))) -> void
Inserts elements from range [first, last). If multiple elements in the range have keys that compare e...
Definition static_set.hpp:195
constexpr auto end() noexcept -> iterator
Returns an iterator to the element following the last element of the set.
Definition static_set.hpp:100
constexpr auto begin() const noexcept -> const_iterator
Returns an iterator to the first element of the set.
Definition static_set.hpp:93
constexpr auto cbegin() const noexcept -> const_iterator
Returns an iterator to the first element of the set.
Definition static_set.hpp:96
size_t size_type
Definition static_set.hpp:45
constexpr auto insert(value_type const &value) noexcept(noexcept(insert(etl::move(declval< key_type >())))) -> pair< iterator, bool > requires(is_copy_constructible_v< value_type >)
Inserts element into the container, if the container doesn't already contain an element with an equiv...
Definition static_set.hpp:182
constexpr auto empty() const noexcept -> bool
Checks if the container has no elements, i.e. whether begin() == end().
Definition static_set.hpp:145
constexpr auto clear() noexcept -> void
Erases all elements from the container. After this call, size() returns zero.
Definition static_set.hpp:160
constexpr auto find(K const &x) const -> const_iterator
Finds an element with key that compares equivalent to the value x.
Definition static_set.hpp:307
etl::reverse_iterator< iterator > reverse_iterator
Definition static_set.hpp:55
constexpr auto equal_range(K const &key) const -> const_iterator
Returns a range containing all elements with the given key in the container. The range is defined by ...
Definition static_set.hpp:431
typename storage_type::const_pointer const_pointer
Definition static_set.hpp:52
constexpr auto count(K const &x) const -> size_type
Returns the number of elements with key that compares equivalent to the value x.
Definition static_set.hpp:268
typename storage_type::const_pointer const_iterator
Definition static_set.hpp:54
constexpr auto full() const noexcept -> bool
Checks if the container full, i.e. whether size() == Capacity.
Definition static_set.hpp:148
constexpr auto contains(K const &x) const -> bool
Checks if there is an element with key that compares equivalent to the value x.
Definition static_set.hpp:323
constexpr auto max_size() const noexcept -> size_type
Returns the maximum number of elements the container is able to hold.
Definition static_set.hpp:156
constexpr auto end() const noexcept -> const_iterator
Returns an iterator to the element following the last element of the set.
Definition static_set.hpp:104
constexpr auto upper_bound(K const &key) const -> const_iterator
Returns an iterator pointing to the first element that is greater than key.
Definition static_set.hpp:387
constexpr auto equal_range(key_type const &key) const -> const_iterator
Returns a range containing all elements with the given key in the container. The range is defined by ...
Definition static_set.hpp:407
constexpr auto operator=(static_set &&other) noexcept(noexcept(etl::move(declval< storage_type >()))) -> static_set &=default
constexpr static_set(static_set const &other)=default
constexpr auto lower_bound(K const &key) -> iterator
Returns an iterator pointing to the first element that is not less than (i.e. greater or equal to) ke...
Definition static_set.hpp:346
constexpr auto crend() const noexcept -> const_reverse_iterator
Returns a reverse iterator to the element following the last element of the reversed set....
Definition static_set.hpp:141
constexpr auto insert(value_type &&value) -> pair< iterator, bool > requires(is_move_constructible_v< value_type >)
Inserts element into the container, if the container doesn't already contain an element with an equiv...
Definition static_set.hpp:164
constexpr auto erase(iterator pos) noexcept -> iterator
Removes the element at pos.
Definition static_set.hpp:217
constexpr auto erase(iterator first, iterator last) -> iterator
Removes the elements in the range [first; last), which must be a valid range in *this.
Definition static_set.hpp:225
constexpr auto upper_bound(key_type const &key) const -> const_iterator
Returns an iterator pointing to the first element that is greater than key.
Definition static_set.hpp:369
constexpr auto rend() const noexcept -> const_reverse_iterator
Returns a reverse iterator to the element following the last element of the reversed set....
Definition static_set.hpp:133
ptrdiff_t difference_type
Definition static_set.hpp:46
constexpr auto size() const noexcept -> size_type
Returns the number of elements in the container, i.e. distance(begin(), end()).
Definition static_set.hpp:152
constexpr auto cend() const noexcept -> const_iterator
Returns an iterator to the element following the last element of the set.
Definition static_set.hpp:108
constexpr auto operator=(static_set const &other) -> static_set &=default
constexpr auto key_comp() const noexcept -> key_compare
Returns the function object that compares the keys, which is a copy of this container's constructor a...
Definition static_set.hpp:441
constexpr auto rbegin() noexcept -> reverse_iterator
Returns a reverse iterator to the first element of the reversed set. It corresponds to the last eleme...
Definition static_set.hpp:112
Dynamically-resizable fixed-capacity vector.
Definition static_vector.hpp:329
typename base_type::pointer pointer
Definition static_vector.hpp:349
typename base_type::const_pointer const_pointer
Definition static_vector.hpp:351
typename base_type::value_type value_type
Definition static_vector.hpp:341