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;
70 typedef typename refmap_t::lookup_t lookup_t;
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;
87 typedef const key_type& const_key_reference;
92 typedef typename refmap_t::iterator
iterator;
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);
129 return refmap_t::begin();
138 return refmap_t::begin();
147 return refmap_t::end();
156 return refmap_t::end();
165 return refmap_t::cbegin();
174 return refmap_t::cend();
183 return refmap_t::rbegin();
192 return refmap_t::rbegin();
201 return refmap_t::rend();
208 const_reverse_iterator
rend()
const
210 return refmap_t::rend();
219 return refmap_t::crbegin();
226 const_reverse_iterator
crend()
const
228 return refmap_t::crend();
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);
269 ::new (
pvalue) value_type(value);
270 ETL_INCREMENT_DEBUG_COUNT;
286 ETL_OR_STD::pair<iterator, bool> result(
end(),
false);
291 ::new (
pvalue) value_type(etl::move(value));
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)
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;
543 return refmap_t::erase(first, last);
567 ETL_RESET_DEBUG_COUNT;
578 return refmap_t::find(key);
586 return refmap_t::find(key);
597 return refmap_t::find(key);
603 const_iterator
find(
const K& key)
const
605 return refmap_t::find(key);
614 size_t count(const_key_reference key)
const
616 return refmap_t::count(key);
622 size_t count(
const K& key)
const
624 return refmap_t::count(key);
635 return refmap_t::lower_bound(key);
643 return refmap_t::lower_bound(key);
654 return refmap_t::lower_bound(key);
662 return refmap_t::lower_bound(key);
673 return refmap_t::upper_bound(key);
681 return refmap_t::upper_bound(key);
692 return refmap_t::upper_bound(key);
700 return refmap_t::upper_bound(key);
709 ETL_OR_STD::pair<iterator, iterator>
equal_range(const_key_reference key)
711 return refmap_t::equal_range(key);
717 ETL_OR_STD::pair<iterator, iterator>
equal_range(
const K& key)
719 return refmap_t::equal_range(key);
728 ETL_OR_STD::pair<const_iterator, const_iterator>
equal_range(const_key_reference key)
const
730 return refmap_t::equal_range(key);
736 ETL_OR_STD::pair<const_iterator, const_iterator>
equal_range(
const K& key)
const
738 return refmap_t::equal_range(key);
790 return refmap_t::size();
799 return refmap_t::empty();
808 return refmap_t::full();
817 return refmap_t::capacity();
826 return refmap_t::max_size();
835 return refmap_t::available();
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_;
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());
1013 this->assign(
rhs.cbegin(),
rhs.cend());
1036 typedef typename etl::iflat_multimap<TKey, TValue, TCompare>::value_type node_t;
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>
1053 flat_multimap(TPairs...) -> flat_multimap<
typename etl::nth_type_t<0, TPairs...>::first_type,
1061#if ETL_USING_CPP11 && ETL_HAS_INITIALIZER_LIST
1062 template <
typename TKey,
typename TMapped,
typename TKeyCompare = etl::less<TKey>,
typename... TPairs>
1063 constexpr auto make_flat_multimap(TPairs&&... pairs) ->
etl::flat_multimap<TKey, TMapped,
sizeof...(TPairs), TKeyCompare>
Definition reference_flat_multimap.h:69
Definition reference_flat_multimap.h:191
Definition reference_flat_multimap.h:107
Definition reference_flat_multimap.h:85
ETL_OR_STD::pair< iterator, bool > insert_at(iterator i_element, value_type &value)
Definition reference_flat_multimap.h:909
#define ETL_ASSERT(b, e)
Definition error_handler.h:316
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:248
T * allocate()
Definition ipool.h:113
void release(const void *const p_object)
Definition ipool.h:239
bitset_ext
Definition absolute.h:38
bool operator!=(const etl::array< T, SIZE > &lhs, const etl::array< T, SIZE > &rhs)
Definition array.h:654
bool operator==(const etl::array< T, SIZE > &lhs, const etl::array< T, SIZE > &rhs)
Definition array.h:642
Definition type_traits_generator.h:2101
iterator
Definition iterator.h:399
pair holds two objects of arbitrary type
Definition utility.h:164
T1 first
first is a copy of the first object
Definition utility.h:168
T2 second
second is a copy of the second object
Definition utility.h:169