31#ifndef ETL_CONST_SET_INCLUDED
32#define ETL_CONST_SET_INCLUDED
36#if ETL_NOT_USING_CPP11
37 #error NOT SUPPORTED FOR C++03 OR BELOW
53 template <
typename TKey,
typename TKeyCompare>
58 using key_type =
TKey;
59 using value_type =
TKey;
62 using const_reference =
const value_type&;
63 using const_pointer =
const value_type*;
64 using const_iterator =
const value_type*;
80 ETL_CONSTEXPR14 const_iterator
begin()
const ETL_NOEXCEPT
96 ETL_CONSTEXPR14 const_iterator
end()
const ETL_NOEXCEPT
98 return element_list_end;
104 ETL_CONSTEXPR14 const_iterator
cend()
const ETL_NOEXCEPT
106 return element_list_end;
123 ETL_CONSTEXPR14 const_iterator
find(
const key_type& key)
const ETL_NOEXCEPT
127 if ((itr !=
end()) && (keys_are_equal(*itr, key)))
143 ETL_CONSTEXPR14 const_iterator
find(
const K& key)
const ETL_NOEXCEPT
147 if ((itr !=
end()) && (keys_are_equal(*itr, key)))
160 ETL_CONSTEXPR14
bool contains(
const key_type& key)
const ETL_NOEXCEPT
172 ETL_CONSTEXPR14
bool contains(
const K& key)
const ETL_NOEXCEPT
182 ETL_CONSTEXPR14 size_type
count(
const key_type& key)
const ETL_NOEXCEPT
194 ETL_CONSTEXPR14 size_type
count(
const K& key)
const ETL_NOEXCEPT
207 ETL_CONSTEXPR14 ETL_OR_STD::pair<const_iterator, const_iterator>
equal_range(
const key_type& key)
const ETL_NOEXCEPT
209 return etl::equal_range(
begin(),
end(), key, vcompare);
222 ETL_CONSTEXPR14 ETL_OR_STD::pair<const_iterator, const_iterator>
equal_range(
const K& key)
const ETL_NOEXCEPT
224 return etl::equal_range(
begin(),
end(), key, vcompare);
233 ETL_CONSTEXPR14 const_iterator
lower_bound(
const key_type& key)
const ETL_NOEXCEPT
235 return etl::lower_bound(
begin(),
end(), key, vcompare);
246 ETL_CONSTEXPR14 const_iterator
lower_bound(
const K& key)
const ETL_NOEXCEPT
248 return etl::lower_bound(
begin(),
end(), key, vcompare);
257 ETL_CONSTEXPR14 const_iterator
upper_bound(
const key_type& key)
const ETL_NOEXCEPT
259 return etl::upper_bound(
begin(),
end(), key, vcompare);
270 ETL_CONSTEXPR14 const_iterator
upper_bound(
const K& key)
const ETL_NOEXCEPT
272 return etl::upper_bound(
begin(),
end(), key, vcompare);
290 return (max_elements != 0) && (
size() == max_elements);
299 return size_type(element_list_end - element_list);
327 return key_compare();
336 return value_compare();
357 ETL_CONSTEXPR14
bool keys_are_equal(const_reference
key1, const_reference
key2)
const ETL_NOEXCEPT
367 ETL_CONSTEXPR14
bool keys_are_equal(
const K1&
key1,
const K2&
key2)
const ETL_NOEXCEPT
372 key_compare kcompare;
373 value_compare vcompare;
375 const value_type* element_list;
376 const value_type* element_list_end;
377 size_type max_elements;
383 template <
typename TKey,
size_t Size,
typename TKeyCompare = etl::less<TKey>>
390 using key_type =
typename base_t::key_type;
391 using value_type =
typename base_t::value_type;
392 using key_compare =
typename base_t::key_compare;
393 using const_reference =
typename base_t::const_reference;
394 using const_pointer =
typename base_t::const_pointer;
395 using const_iterator =
typename base_t::const_iterator;
396 using size_type =
typename base_t::size_type;
414 static_assert(
sizeof...(elements) <= Size,
"Number of elements exceeds capacity");
419 value_type element_list[Size];
433 template <
typename TKey,
typename TKeyCompare = etl::less<TKey>>
440 using key_type =
typename base_t::key_type;
441 using value_type =
typename base_t::value_type;
442 using key_compare =
typename base_t::key_compare;
443 using const_reference =
typename base_t::const_reference;
444 using const_pointer =
typename base_t::const_pointer;
445 using const_iterator =
typename base_t::const_iterator;
446 using size_type =
typename base_t::size_type;
449 using const_reference =
const key_type&;
464 template <
size_type Size>
473 template <
size_type Size>
484 template <
typename TElements,
size_t N>
487 template <
typename TElements,
size_t N>
494 template <
typename TKey,
typename TKeyCompare>
498 return (
lhs.size() ==
rhs.size()) && etl::equal(
lhs.begin(),
lhs.end(),
rhs.begin());
504 template <
typename TKey,
typename TKeyCompare>
514 template <
typename TKey,
typename TKeyCompare>
518 return etl::lexicographical_compare(
lhs.begin(),
lhs.end(),
526 template <
typename TKey,
typename TKeyCompare>
536 template <
typename TKey,
typename TKeyCompare>
546 template <
typename TKey,
typename TKeyCompare>
Template deduction guides.
Definition const_set.h:435
ETL_CONSTEXPR14 const_set_ext(const value_type(&begin_)[Size]) ETL_NOEXCEPT
Construct a const_set from an array.
Definition const_set.h:474
ETL_CONSTEXPR14 const_set_ext() ETL_NOEXCEPT
Default construct a const_set.
Definition const_set.h:456
ETL_CONSTEXPR14 const_set_ext(const etl::span< const value_type, Size > &sp) ETL_NOEXCEPT
Construct a const_set from a variadic list of elements.
Definition const_set.h:465
Map type designed for constexpr.
Definition const_set.h:385
const key_type & const_key_reference
Defines the parameter types.
Definition const_set.h:399
ETL_CONSTEXPR14 const_set(TElements &&... elements) ETL_NOEXCEPT
Construct a const_set from a variadic list of elements. Static asserts if the elements are not of typ...
Definition const_set.h:409
Definition const_set.h:55
ETL_CONSTEXPR14 key_compare key_comp() const ETL_NOEXCEPT
Definition const_set.h:325
ETL_CONSTEXPR14 bool contains(const key_type &key) const ETL_NOEXCEPT
Checks if the set contains an element with key.
Definition const_set.h:160
ETL_CONSTEXPR14 size_type size() const ETL_NOEXCEPT
Definition const_set.h:297
ETL_CONSTEXPR14 size_type capacity() const ETL_NOEXCEPT
Definition const_set.h:316
ETL_CONSTEXPR14 bool is_valid() const ETL_NOEXCEPT
Definition const_set.h:72
ETL_CONSTEXPR14 const_iterator upper_bound(const key_type &key) const ETL_NOEXCEPT
Returns a const_iterator to the first element that is greater than the key. Returns a const_iterator ...
Definition const_set.h:257
ETL_CONSTEXPR14 size_type empty() const ETL_NOEXCEPT
Definition const_set.h:279
ETL_CONSTEXPR14 bool contains(const K &key) const ETL_NOEXCEPT
Checks if the set contains an element with key. Enabled if the comparator is transparent.
Definition const_set.h:172
ETL_CONSTEXPR14 const_iterator begin() const ETL_NOEXCEPT
Returns a const_iterator to the beginning of the set.
Definition const_set.h:80
ETL_CONSTEXPR14 ETL_OR_STD::pair< const_iterator, const_iterator > equal_range(const key_type &key) const ETL_NOEXCEPT
Returns a range containing all elements with the key. The range is defined by a pair of two iterators...
Definition const_set.h:207
ETL_CONSTEXPR14 const_iterator lower_bound(const key_type &key) const ETL_NOEXCEPT
Returns a const_iterator to the first element that is not less than the key. Returns a const_iterator...
Definition const_set.h:233
ETL_CONSTEXPR14 const_iterator find(const K &key) const ETL_NOEXCEPT
Gets a const_iterator to the key. Enabled if the comparator is transparent.
Definition const_set.h:143
ETL_CONSTEXPR14 const_iterator cbegin() const ETL_NOEXCEPT
Returns a const_iterator to the beginning of the set.
Definition const_set.h:88
ETL_CONSTEXPR14 size_type max_size() const ETL_NOEXCEPT
Definition const_set.h:306
ETL_CONSTEXPR14 size_type full() const ETL_NOEXCEPT
Definition const_set.h:288
ETL_CONSTEXPR14 const_iterator cend() const ETL_NOEXCEPT
Returns a const_iterator to the end of the set.
Definition const_set.h:104
ETL_CONSTEXPR14 const_iterator find(const key_type &key) const ETL_NOEXCEPT
Gets a const_iterator to the key.
Definition const_set.h:123
ETL_CONSTEXPR14 iconst_set(const value_type *element_list_, size_type size_, size_type max_elements_) ETL_NOEXCEPT
Constructor.
Definition const_set.h:345
ETL_CONSTEXPR14 size_type count(const K &key) const ETL_NOEXCEPT
Counts the numbeer elements with key. Enabled if the comparator is transparent.
Definition const_set.h:194
ETL_CONSTEXPR14 const_iterator end() const ETL_NOEXCEPT
Returns a const_iterator to the end of the set.
Definition const_set.h:96
ETL_CONSTEXPR14 const_pointer data() const ETL_NOEXCEPT
Returns a const_pointer to the beginning of the set.
Definition const_set.h:112
ETL_CONSTEXPR14 size_type count(const key_type &key) const ETL_NOEXCEPT
Counts the numbeer elements with key.
Definition const_set.h:182
ETL_CONSTEXPR14 value_compare value_comp() const ETL_NOEXCEPT
Definition const_set.h:334
ETL_CONSTEXPR14 const_iterator upper_bound(const K &key) const ETL_NOEXCEPT
Returns a const_iterator to the first element that is greater than the key. Returns a const_iterator ...
Definition const_set.h:270
ETL_CONSTEXPR14 const_iterator lower_bound(const K &key) const ETL_NOEXCEPT
Returns a const_iterator to the first element that is not less than the key. Returns a const_iterator...
Definition const_set.h:246
ETL_CONSTEXPR14 ETL_OR_STD::pair< const_iterator, const_iterator > equal_range(const K &key) const ETL_NOEXCEPT
Returns a range containing all elements with the key. The range is defined by a pair of two iterators...
Definition const_set.h:222
Span - Fixed Extent.
Definition span.h:110
ETL_NODISCARD ETL_CONSTEXPR14 bool is_unique_sorted(TIterator begin, TIterator end)
Definition algorithm.h:1794
bitset_ext
Definition absolute.h:38
bool operator>(const etl::array< T, SIZE > &lhs, const etl::array< T, SIZE > &rhs)
Definition array.h:1148
bool operator>=(const etl::array< T, SIZE > &lhs, const etl::array< T, SIZE > &rhs)
Definition array.h:1160
bool operator!=(const etl::array< T, SIZE > &lhs, const etl::array< T, SIZE > &rhs)
Definition array.h:1109
bool operator==(const etl::array< T, SIZE > &lhs, const etl::array< T, SIZE > &rhs)
Definition array.h:1097
ETL_NODISCARD ETL_CONSTEXPR14 T round_half_even_unscaled(T value) ETL_NOEXCEPT
Definition scaled_rounding.h:314
bool operator<(const etl::array< T, SIZE > &lhs, const etl::array< T, SIZE > &rhs)
Definition array.h:1121
bool operator<=(const etl::array< T, SIZE > &lhs, const etl::array< T, SIZE > &rhs)
Definition array.h:1136
Definition type_traits_generator.h:2226