31#ifndef ETL_FLAT_MULTMAP_INCLUDED
32#define ETL_FLAT_MULTMAP_INCLUDED
60 template <
typename TKey,
typename TMapped,
typename TKeyCompare = etl::less<TKey> >
65 typedef ETL_OR_STD::pair<const TKey, TMapped> value_type;
75 typedef TKey key_type;
78 typedef value_type& reference;
79 typedef const value_type& const_reference;
83 typedef value_type* pointer;
84 typedef const value_type* const_pointer;
85 typedef size_t size_type;
87 typedef const key_type& const_key_reference;
95 typedef ETL_OR_STD::reverse_iterator<iterator> reverse_iterator;
96 typedef ETL_OR_STD::reverse_iterator<const_iterator> const_reverse_iterator;
97 typedef typename etl::iterator_traits<iterator>::difference_type difference_type;
108 bool operator ()(
const value_type& element, key_type key)
const
110 return comp(element.first, key);
113 bool operator ()(key_type key,
const value_type& element)
const
115 return comp(key, element.first);
208 const_reverse_iterator
rend()
const
226 const_reverse_iterator
crend()
const
238 template <
typename TIterator>
241#if ETL_IS_DEBUG_BUILD
242 difference_type d = etl::distance(first, last);
248 while (first != last)
260 ETL_OR_STD::pair<iterator, bool>
insert(
const value_type& value)
264 ETL_OR_STD::pair<iterator, bool> result(
end(),
false);
270 ETL_INCREMENT_DEBUG_COUNT;
286 ETL_OR_STD::pair<iterator, bool> result(
end(),
false);
292 ETL_INCREMENT_DEBUG_COUNT;
307 return insert(value).first;
319 return insert(etl::move(value)).first;
330 template <
class TIterator>
333 while (first != last)
343 ETL_OR_STD::pair<iterator, bool>
emplace(
const value_type& value)
351 ETL_OR_STD::pair<iterator, bool>
emplace(
const key_type& key,
const mapped_type&
mapped)
360 ETL_INCREMENT_DEBUG_COUNT;
365#if ETL_USING_CPP11 && ETL_NOT_USING_STLPORT
369 template <
typename ...
Args>
370 ETL_OR_STD::pair<iterator, bool>
emplace(
const key_type& key,
Args && ...
args)
379 ETL_INCREMENT_DEBUG_COUNT;
388 template <
typename T1>
389 ETL_OR_STD::pair<iterator, bool>
emplace(
const key_type& key,
const T1& value1)
398 ETL_INCREMENT_DEBUG_COUNT;
406 template <
typename T1,
typename T2>
407 ETL_OR_STD::pair<iterator, bool>
emplace(
const key_type& key,
const T1& value1,
const T2& value2)
416 ETL_INCREMENT_DEBUG_COUNT;
424 template <
typename T1,
typename T2,
typename T3>
425 ETL_OR_STD::pair<iterator, bool>
emplace(
const key_type& key,
const T1& value1,
const T2& value2,
const T3& value3)
434 ETL_INCREMENT_DEBUG_COUNT;
442 template <
typename T1,
typename T2,
typename T3,
typename T4>
443 ETL_OR_STD::pair<iterator, bool>
emplace(
const key_type& key,
const T1& value1,
const T2& value2,
const T3& value3,
const T4& value4)
452 ETL_INCREMENT_DEBUG_COUNT;
464 size_t erase(const_key_reference key)
466 ETL_OR_STD::pair<iterator, iterator> range =
equal_range(key);
468 if (range.first ==
end())
474 size_t d = etl::distance(range.first, range.second);
475 erase(range.first, range.second);
487 if (range.first ==
end())
493 size_t d = etl::distance(range.first, range.second);
494 erase(range.first, range.second);
508 ETL_DECREMENT_DEBUG_COUNT;
520 ETL_DECREMENT_DEBUG_COUNT;
540 ETL_DECREMENT_DEBUG_COUNT;
567 ETL_RESET_DEBUG_COUNT;
603 const_iterator
find(
const K& key)
const
614 size_t count(const_key_reference key)
const
622 size_t count(
const K& key)
const
709 ETL_OR_STD::pair<iterator, iterator>
equal_range(const_key_reference key)
717 ETL_OR_STD::pair<iterator, iterator>
equal_range(
const K& key)
728 ETL_OR_STD::pair<const_iterator, const_iterator>
equal_range(const_key_reference key)
const
736 ETL_OR_STD::pair<const_iterator, const_iterator>
equal_range(
const K& key)
const
864 while (first != last)
869 this->
insert(etl::move(*first));
884 ETL_DECLARE_DEBUG_COUNT;
889#if defined(ETL_POLYMORPHIC_FLAT_MULTIMAP) || defined(ETL_POLYMORPHIC_CONTAINERS)
909 template <
typename TKey,
typename TMapped,
typename TKeyCompare>
912 return (
lhs.size() ==
rhs.size()) && etl::equal(
lhs.begin(),
lhs.end(),
rhs.begin());
922 template <
typename TKey,
typename TMapped,
typename TKeyCompare>
936 template <
typename TKey,
typename TValue, const
size_t MAX_SIZE_,
typename TCompare = etl::less<TKey> >
941 static ETL_CONSTANT
size_t MAX_SIZE = MAX_SIZE_;
969 this->move_container(etl::move(other));
980 template <
typename TIterator>
984 this->assign(first, last);
987#if ETL_HAS_INITIALIZER_LIST
991 flat_multimap(std::initializer_list<
typename etl::iflat_multimap<TKey, TValue, TCompare>::value_type> init)
994 this->assign(init.begin(), init.end());
1027 this->move_container(etl::move(rhs));
1036 typedef typename etl::iflat_multimap<TKey, TValue, TCompare>::value_type node_t;
1042 etl::vector<node_t*, MAX_SIZE> lookup;
1045 template <
typename TKey,
typename TValue, const
size_t MAX_SIZE_,
typename TCompare>
1046 ETL_CONSTANT
size_t flat_multimap<TKey, TValue, MAX_SIZE_, TCompare>::MAX_SIZE;
1051#if ETL_USING_CPP17 && ETL_HAS_INITIALIZER_LIST
1052 template <
typename...
TPairs>
1061#if ETL_USING_CPP11 && ETL_HAS_INITIALIZER_LIST
1062 template <
typename TKey,
typename TMapped,
typename TKeyCompare = etl::less<TKey>,
typename... TPairs>
Definition reference_flat_multimap.h:69
Definition reference_flat_multimap.h:191
Definition reference_flat_multimap.h:107
Definition reference_flat_multimap.h:85
const_reverse_iterator crbegin() const
Definition reference_flat_multimap.h:423
size_t count(key_parameter_t key) const
Definition reference_flat_multimap.h:683
ETL_OR_STD::pair< iterator, iterator > equal_range(key_parameter_t key)
Definition reference_flat_multimap.h:782
iterator lower_bound(key_parameter_t key)
Definition reference_flat_multimap.h:706
reverse_iterator rbegin()
Definition reference_flat_multimap.h:387
const_reverse_iterator crend() const
Definition reference_flat_multimap.h:432
iterator upper_bound(key_parameter_t key)
Definition reference_flat_multimap.h:744
bool empty() const
Definition reference_flat_multimap.h:853
const_iterator cbegin() const
Definition reference_flat_multimap.h:369
size_type size() const
Definition reference_flat_multimap.h:844
ETL_OR_STD::pair< iterator, bool > insert_at(iterator i_element, value_type &value)
Definition reference_flat_multimap.h:909
size_t available() const
Definition reference_flat_multimap.h:889
bool full() const
Definition reference_flat_multimap.h:862
size_t erase(key_parameter_t key)
Definition reference_flat_multimap.h:510
iterator begin()
Definition reference_flat_multimap.h:333
iterator end()
Definition reference_flat_multimap.h:351
iterator find(key_parameter_t key)
Definition reference_flat_multimap.h:589
const_iterator cend() const
Definition reference_flat_multimap.h:378
size_type max_size() const
Definition reference_flat_multimap.h:880
void clear()
Clears the reference_flat_multimap.
Definition reference_flat_multimap.h:579
size_type capacity() const
Definition reference_flat_multimap.h:871
reverse_iterator rend()
Definition reference_flat_multimap.h:405
#define ETL_ASSERT(b, e)
Definition error_handler.h:356
const_iterator begin() const
Definition flat_multimap.h:136
const_reverse_iterator crbegin() const
Definition flat_multimap.h:217
reverse_iterator rbegin()
Definition flat_multimap.h:181
iterator end()
Definition flat_multimap.h:145
size_type capacity() const
Definition flat_multimap.h:815
size_type size() const
Definition flat_multimap.h:788
const_iterator cbegin() const
Definition flat_multimap.h:163
ETL_OR_STD::pair< iterator, bool > emplace(const key_type &key, const T1 &value1, const T2 &value2)
Emplaces a value to the map.
Definition flat_multimap.h:407
size_t available() const
Definition flat_multimap.h:833
ETL_OR_STD::pair< const_iterator, const_iterator > equal_range(const_key_reference key) const
Definition flat_multimap.h:728
flat_multimap(TIterator first, TIterator last)
Definition flat_multimap.h:981
const_reverse_iterator rbegin() const
Definition flat_multimap.h:190
bool full() const
Definition flat_multimap.h:806
const_iterator upper_bound(const_key_reference key) const
Definition flat_multimap.h:690
size_type max_size() const
Definition flat_multimap.h:824
size_t erase(const_key_reference key)
Definition flat_multimap.h:464
size_t count(const_key_reference key) const
Definition flat_multimap.h:614
const_reverse_iterator rend() const
Definition flat_multimap.h:208
iterator erase(const_iterator i_element)
Definition flat_multimap.h:516
iflat_multimap(lookup_t &lookup_, storage_t &storage_)
Constructor.
Definition flat_multimap.h:843
iterator insert(const_iterator, const value_type &value)
Definition flat_multimap.h:305
ETL_OR_STD::pair< iterator, bool > emplace(const value_type &value)
Emplaces a value to the map.
Definition flat_multimap.h:343
const_iterator end() const
Definition flat_multimap.h:154
iflat_multimap & operator=(const iflat_multimap &rhs)
Assignment operator.
Definition flat_multimap.h:762
flat_multimap()
Constructor.
Definition flat_multimap.h:946
const_reverse_iterator crend() const
Definition flat_multimap.h:226
ETL_OR_STD::pair< iterator, bool > emplace(const key_type &key, const mapped_type &mapped)
Emplaces a value to the map.
Definition flat_multimap.h:351
bool contains(const_key_reference key) const
Check if the map contains the key.
Definition flat_multimap.h:745
iterator begin()
Definition flat_multimap.h:127
const_iterator cend() const
Definition flat_multimap.h:172
void clear()
Clears the flat_multimap.
Definition flat_multimap.h:549
ETL_OR_STD::pair< iterator, bool > emplace(const key_type &key, const T1 &value1, const T2 &value2, const T3 &value3, const T4 &value4)
Emplaces a value to the map.
Definition flat_multimap.h:443
reverse_iterator rend()
Definition flat_multimap.h:199
iterator erase(const_iterator first, const_iterator last)
Definition flat_multimap.h:531
~flat_multimap()
Destructor.
Definition flat_multimap.h:1001
ETL_OR_STD::pair< iterator, iterator > equal_range(const_key_reference key)
Definition flat_multimap.h:709
void assign(TIterator first, TIterator last)
Definition flat_multimap.h:239
iterator upper_bound(const_key_reference key)
Definition flat_multimap.h:671
ETL_OR_STD::pair< iterator, bool > emplace(const key_type &key, const T1 &value1, const T2 &value2, const T3 &value3)
Emplaces a value to the map.
Definition flat_multimap.h:425
ETL_OR_STD::pair< iterator, bool > insert(const value_type &value)
Definition flat_multimap.h:260
const_iterator find(const_key_reference key) const
Definition flat_multimap.h:595
const_iterator lower_bound(const_key_reference key) const
Definition flat_multimap.h:652
~iflat_multimap()
Destructor.
Definition flat_multimap.h:896
flat_multimap(const flat_multimap &other)
Copy constructor.
Definition flat_multimap.h:954
bool empty() const
Definition flat_multimap.h:797
void insert(TIterator first, TIterator last)
Definition flat_multimap.h:331
ETL_OR_STD::pair< iterator, bool > emplace(const key_type &key, const T1 &value1)
Emplaces a value to the map.
Definition flat_multimap.h:389
iterator find(const_key_reference key)
Definition flat_multimap.h:576
iterator lower_bound(const_key_reference key)
Definition flat_multimap.h:633
iterator erase(iterator i_element)
Definition flat_multimap.h:504
Definition flat_multimap.h:938
Definition flat_multimap.h:62
ETL_CONSTEXPR17 etl::enable_if<!etl::is_same< T, etl::nullptr_t >::value, T >::type * addressof(T &t)
Definition addressof.h:52
void release_all()
Release all objects in the pool.
Definition ipool.h:451
T * allocate()
Definition ipool.h:316
void release(const void *const p_object)
Definition ipool.h:442
bitset_ext
Definition absolute.h:38
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
Definition type_traits_generator.h:2190
iterator
Definition iterator.h:399