Embedded Template Library 1.0
flat_multimap.h
Go to the documentation of this file.
1
2
3/******************************************************************************
4The MIT License(MIT)
5
6Embedded Template Library.
7https://github.com/ETLCPP/etl
8https://www.etlcpp.com
9
10Copyright(c) 2015 John Wellbelove
11
12Permission is hereby granted, free of charge, to any person obtaining a copy
13of this software and associated documentation files(the "Software"), to deal
14in the Software without restriction, including without limitation the rights
15to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
16copies of the Software, and to permit persons to whom the Software is
17furnished to do so, subject to the following conditions :
18
19The above copyright notice and this permission notice shall be included in all
20copies or substantial portions of the Software.
21
22THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
25AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28SOFTWARE.
29******************************************************************************/
30
31#ifndef ETL_FLAT_MULTMAP_INCLUDED
32#define ETL_FLAT_MULTMAP_INCLUDED
33
34#include "platform.h"
36#include "pool.h"
37#include "utility.h"
38#include "placement_new.h"
39#include "nth_type.h"
40#include "type_traits.h"
41#include "initializer_list.h"
42
44
45//*****************************************************************************
51//*****************************************************************************
52
53namespace etl
54{
55 //***************************************************************************
59 //***************************************************************************
60 template <typename TKey, typename TMapped, typename TKeyCompare = etl::less<TKey> >
61 class iflat_multimap : public etl::ireference_flat_multimap<TKey, TMapped, TKeyCompare>
62 {
63 public:
64
65 typedef ETL_OR_STD::pair<const TKey, TMapped> value_type;
66
67 private:
68
70 typedef typename refmap_t::lookup_t lookup_t;
71 typedef etl::ipool storage_t;
72
73 public:
74
75 typedef TKey key_type;
76 typedef TMapped mapped_type;
77 typedef TKeyCompare key_compare;
78 typedef value_type& reference;
79 typedef const value_type& const_reference;
80#if ETL_USING_CPP11
81 typedef value_type&& rvalue_reference;
82#endif
83 typedef value_type* pointer;
84 typedef const value_type* const_pointer;
85 typedef size_t size_type;
86
87 typedef const key_type& const_key_reference;
88#if ETL_USING_CPP11
89 typedef key_type&& rvalue_key_reference;
90#endif
91
92 typedef typename refmap_t::iterator iterator;
94
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;
98
99 private:
100
101 //*********************************************************************
103 //*********************************************************************
104 class compare
105 {
106 public:
107
108 bool operator ()(const value_type& element, key_type key) const
109 {
110 return comp(element.first, key);
111 }
112
113 bool operator ()(key_type key, const value_type& element) const
114 {
115 return comp(key, element.first);
116 }
117
118 key_compare comp;
119 };
120
121 public:
122
123 //*********************************************************************
126 //*********************************************************************
128 {
129 return refmap_t::begin();
130 }
131
132 //*********************************************************************
135 //*********************************************************************
137 {
138 return refmap_t::begin();
139 }
140
141 //*********************************************************************
144 //*********************************************************************
146 {
147 return refmap_t::end();
148 }
149
150 //*********************************************************************
153 //*********************************************************************
155 {
156 return refmap_t::end();
157 }
158
159 //*********************************************************************
162 //*********************************************************************
164 {
165 return refmap_t::cbegin();
166 }
167
168 //*********************************************************************
171 //*********************************************************************
173 {
174 return refmap_t::cend();
175 }
176
177 //*********************************************************************
180 //*********************************************************************
181 reverse_iterator rbegin()
182 {
183 return refmap_t::rbegin();
184 }
185
186 //*********************************************************************
189 //*********************************************************************
190 const_reverse_iterator rbegin() const
191 {
192 return refmap_t::rbegin();
193 }
194
195 //*********************************************************************
198 //*********************************************************************
199 reverse_iterator rend()
200 {
201 return refmap_t::rend();
202 }
203
204 //*********************************************************************
207 //*********************************************************************
208 const_reverse_iterator rend() const
209 {
210 return refmap_t::rend();
211 }
212
213 //*********************************************************************
216 //*********************************************************************
217 const_reverse_iterator crbegin() const
218 {
219 return refmap_t::crbegin();
220 }
221
222 //*********************************************************************
225 //*********************************************************************
226 const_reverse_iterator crend() const
227 {
228 return refmap_t::crend();
229 }
230
231 //*********************************************************************
237 //*********************************************************************
238 template <typename TIterator>
239 void assign(TIterator first, TIterator last)
240 {
241#if ETL_IS_DEBUG_BUILD
242 difference_type d = etl::distance(first, last);
243 ETL_ASSERT(d <= difference_type(capacity()), ETL_ERROR(flat_multimap_full));
244#endif
245
246 clear();
247
248 while (first != last)
249 {
250 insert(*first);
251 ++first;
252 }
253 }
254
255 //*********************************************************************
259 //*********************************************************************
260 ETL_OR_STD::pair<iterator, bool> insert(const value_type& value)
261 {
263
264 ETL_OR_STD::pair<iterator, bool> result(end(), false);
265
266 iterator i_element = upper_bound(value.first);
267
268 value_type* pvalue = storage.allocate<value_type>();
269 ::new (pvalue) value_type(value);
270 ETL_INCREMENT_DEBUG_COUNT
271 result = refmap_t::insert_at(i_element, *pvalue);
272
273 return result;
274 }
275
276#if ETL_USING_CPP11
277 //*********************************************************************
281 //*********************************************************************
282 ETL_OR_STD::pair<iterator, bool> insert(rvalue_reference value)
283 {
285
286 ETL_OR_STD::pair<iterator, bool> result(end(), false);
287
288 iterator i_element = upper_bound(value.first);
289
290 value_type* pvalue = storage.allocate<value_type>();
291 ::new (pvalue) value_type(etl::move(value));
292 ETL_INCREMENT_DEBUG_COUNT
293 result = refmap_t::insert_at(i_element, *pvalue);
294
295 return result;
296 }
297#endif
298
299 //*********************************************************************
304 //*********************************************************************
305 iterator insert(const_iterator /*position*/, const value_type& value)
306 {
307 return insert(value).first;
308 }
309
310#if ETL_USING_CPP11
311 //*********************************************************************
316 //*********************************************************************
317 iterator insert(const_iterator /*position*/, rvalue_reference value)
318 {
319 return insert(etl::move(value)).first;
320 }
321#endif
322
323 //*********************************************************************
329 //*********************************************************************
330 template <class TIterator>
331 void insert(TIterator first, TIterator last)
332 {
333 while (first != last)
334 {
335 insert(*first);
336 ++first;
337 }
338 }
339
340 //*************************************************************************
342 //*************************************************************************
343 ETL_OR_STD::pair<iterator, bool> emplace(const value_type& value)
344 {
345 return insert(value);
346 }
347
348 //*************************************************************************
350 //*************************************************************************
351 ETL_OR_STD::pair<iterator, bool> emplace(const key_type& key, const mapped_type& mapped)
352 {
353 ETL_ASSERT(!full(), ETL_ERROR(flat_multimap_full));
354
355 // Create it.
356 value_type* pvalue = storage.allocate<value_type>();
357 ::new ((void*)etl::addressof(pvalue->first)) key_type(key);
358 ::new ((void*)etl::addressof(pvalue->second)) mapped_type(mapped);
359 iterator i_element = upper_bound(key);
360 ETL_INCREMENT_DEBUG_COUNT
361
362 return refmap_t::insert_at(i_element, *pvalue);
363 }
364
365#if ETL_USING_CPP11 && ETL_NOT_USING_STLPORT
366 //*************************************************************************
368 //*************************************************************************
369 template <typename ... Args>
370 ETL_OR_STD::pair<iterator, bool> emplace(const key_type& key, Args && ... args)
371 {
372 ETL_ASSERT(!full(), ETL_ERROR(flat_multimap_full));
373
374 // Create it.
375 value_type* pvalue = storage.allocate<value_type>();
376 ::new ((void*)etl::addressof(pvalue->first)) key_type(key);
377 ::new ((void*)etl::addressof(pvalue->second)) mapped_type(etl::forward<Args>(args)...);
378 iterator i_element = upper_bound(key);
379 ETL_INCREMENT_DEBUG_COUNT
380
381 return refmap_t::insert_at(i_element, *pvalue);
382 }
383
384#else
385 //*************************************************************************
387 //*************************************************************************
388 template <typename T1>
389 ETL_OR_STD::pair<iterator, bool> emplace(const key_type& key, const T1& value1)
390 {
391 ETL_ASSERT(!full(), ETL_ERROR(flat_multimap_full));
392
393 // Create it.
394 value_type* pvalue = storage.allocate<value_type>();
395 ::new ((void*)etl::addressof(pvalue->first)) key_type(key);
396 ::new ((void*)etl::addressof(pvalue->second)) mapped_type(value1);
397 iterator i_element = upper_bound(key);
398 ETL_INCREMENT_DEBUG_COUNT
399
400 return refmap_t::insert_at(i_element, *pvalue);
401 }
402
403 //*************************************************************************
405 //*************************************************************************
406 template <typename T1, typename T2>
407 ETL_OR_STD::pair<iterator, bool> emplace(const key_type& key, const T1& value1, const T2& value2)
408 {
409 ETL_ASSERT(!full(), ETL_ERROR(flat_multimap_full));
410
411 // Create it.
412 value_type* pvalue = storage.allocate<value_type>();
413 ::new ((void*)etl::addressof(pvalue->first)) key_type(key);
414 ::new ((void*)etl::addressof(pvalue->second)) mapped_type(value1, value2);
415 iterator i_element = upper_bound(key);
416 ETL_INCREMENT_DEBUG_COUNT
417
418 return refmap_t::insert_at(i_element, *pvalue);
419 }
420
421 //*************************************************************************
423 //*************************************************************************
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)
426 {
427 ETL_ASSERT(!full(), ETL_ERROR(flat_multimap_full));
428
429 // Create it.
430 value_type* pvalue = storage.allocate<value_type>();
431 ::new ((void*)etl::addressof(pvalue->first)) key_type(key);
432 ::new ((void*)etl::addressof(pvalue->second)) mapped_type(value1, value2, value3);
433 iterator i_element = upper_bound(key);
434 ETL_INCREMENT_DEBUG_COUNT
435
436 return refmap_t::insert_at(i_element, *pvalue);
437 }
438
439 //*************************************************************************
441 //*************************************************************************
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)
444 {
445 ETL_ASSERT(!full(), ETL_ERROR(flat_multimap_full));
446
447 // Create it.
448 value_type* pvalue = storage.allocate<value_type>();
449 ::new ((void*)etl::addressof(pvalue->first)) key_type(key);
450 ::new ((void*)etl::addressof(pvalue->second)) mapped_type(value1, value2, value3, value4);
451 iterator i_element = upper_bound(key);
452 ETL_INCREMENT_DEBUG_COUNT
453
454 return refmap_t::insert_at(i_element, *pvalue);
455 }
456
457#endif
458
459 //*********************************************************************
463 //*********************************************************************
464 size_t erase(const_key_reference key)
465 {
466 ETL_OR_STD::pair<iterator, iterator> range = equal_range(key);
467
468 if (range.first == end())
469 {
470 return 0;
471 }
472 else
473 {
474 size_t d = etl::distance(range.first, range.second);
475 erase(range.first, range.second);
476 return d;
477 }
478 }
479
480#if ETL_USING_CPP11
481 //*********************************************************************
482 template <typename K, typename KC = TKeyCompare, etl::enable_if_t<comparator_is_transparent<KC>::value, int> = 0>
483 size_t erase(K&& key)
484 {
485 ETL_OR_STD::pair<iterator, iterator> range = equal_range(etl::forward<K>(key));
486
487 if (range.first == end())
488 {
489 return 0;
490 }
491 else
492 {
493 size_t d = etl::distance(range.first, range.second);
494 erase(range.first, range.second);
495 return d;
496 }
497 }
498#endif
499
500 //*********************************************************************
503 //*********************************************************************
505 {
506 i_element->~value_type();
507 storage.release(etl::addressof(*i_element));
508 ETL_DECREMENT_DEBUG_COUNT
509 return refmap_t::erase(i_element);
510 }
511
512 //*********************************************************************
515 //*********************************************************************
517 {
518 i_element->~value_type();
519 storage.release(etl::addressof(*i_element));
520 ETL_DECREMENT_DEBUG_COUNT
521 return refmap_t::erase(i_element);
522 }
523
524 //*********************************************************************
530 //*********************************************************************
532 {
533 const_iterator itr = first;
534
535 while (itr != last)
536 {
537 itr->~value_type();
538 storage.release(etl::addressof(*itr));
539 ++itr;
540 ETL_DECREMENT_DEBUG_COUNT
541 }
542
543 return refmap_t::erase(first, last);
544 }
545
546 //*************************************************************************
548 //*************************************************************************
549 void clear()
550 {
552 {
553 storage.release_all();
554 }
555 else
556 {
557 iterator itr = begin();
558
559 while (itr != end())
560 {
561 itr->~value_type();
562 storage.release(etl::addressof(*itr));
563 ++itr;
564 }
565 }
566
567 ETL_RESET_DEBUG_COUNT
569 }
570
571 //*********************************************************************
575 //*********************************************************************
576 iterator find(const_key_reference key)
577 {
578 return refmap_t::find(key);
579 }
580
581#if ETL_USING_CPP11
582 //*********************************************************************
583 template <typename K, typename KC = TKeyCompare, etl::enable_if_t<comparator_is_transparent<KC>::value, int> = 0>
584 iterator find(const K& key)
585 {
586 return refmap_t::find(key);
587 }
588#endif
589
590 //*********************************************************************
594 //*********************************************************************
595 const_iterator find(const_key_reference key) const
596 {
597 return refmap_t::find(key);
598 }
599
600#if ETL_USING_CPP11
601 //*********************************************************************
602 template <typename K, typename KC = TKeyCompare, etl::enable_if_t<comparator_is_transparent<KC>::value, int> = 0>
603 const_iterator find(const K& key) const
604 {
605 return refmap_t::find(key);
606 }
607#endif
608
609 //*********************************************************************
613 //*********************************************************************
614 size_t count(const_key_reference key) const
615 {
616 return refmap_t::count(key);
617 }
618
619#if ETL_USING_CPP11
620 //*********************************************************************
621 template <typename K, typename KC = TKeyCompare, etl::enable_if_t<comparator_is_transparent<KC>::value, int> = 0>
622 size_t count(const K& key) const
623 {
624 return refmap_t::count(key);
625 }
626#endif
627
628 //*********************************************************************
632 //*********************************************************************
633 iterator lower_bound(const_key_reference key)
634 {
635 return refmap_t::lower_bound(key);
636 }
637
638#if ETL_USING_CPP11
639 //*********************************************************************
640 template <typename K, typename KC = TKeyCompare, etl::enable_if_t<comparator_is_transparent<KC>::value, int> = 0>
641 iterator lower_bound(const K& key)
642 {
643 return refmap_t::lower_bound(key);
644 }
645#endif
646
647 //*********************************************************************
651 //*********************************************************************
652 const_iterator lower_bound(const_key_reference key) const
653 {
654 return refmap_t::lower_bound(key);
655 }
656
657#if ETL_USING_CPP11
658 //*********************************************************************
659 template <typename K, typename KC = TKeyCompare, etl::enable_if_t<comparator_is_transparent<KC>::value, int> = 0>
660 const_iterator lower_bound(const K& key) const
661 {
662 return refmap_t::lower_bound(key);
663 }
664#endif
665
666 //*********************************************************************
670 //*********************************************************************
671 iterator upper_bound(const_key_reference key)
672 {
673 return refmap_t::upper_bound(key);
674 }
675
676#if ETL_USING_CPP11
677 //*********************************************************************
678 template <typename K, typename KC = TKeyCompare, etl::enable_if_t<comparator_is_transparent<KC>::value, int> = 0>
679 iterator upper_bound(const K& key)
680 {
681 return refmap_t::upper_bound(key);
682 }
683#endif
684
685 //*********************************************************************
689 //*********************************************************************
690 const_iterator upper_bound(const_key_reference key) const
691 {
692 return refmap_t::upper_bound(key);
693 }
694
695#if ETL_USING_CPP11
696 //*********************************************************************
697 template <typename K, typename KC = TKeyCompare, etl::enable_if_t<comparator_is_transparent<KC>::value, int> = 0>
698 const_iterator upper_bound(const K& key) const
699 {
700 return refmap_t::upper_bound(key);
701 }
702#endif
703
704 //*********************************************************************
708 //*********************************************************************
709 ETL_OR_STD::pair<iterator, iterator> equal_range(const_key_reference key)
710 {
711 return refmap_t::equal_range(key);
712 }
713
714#if ETL_USING_CPP11
715 //*********************************************************************
716 template <typename K, typename KC = TKeyCompare, etl::enable_if_t<comparator_is_transparent<KC>::value, int> = 0>
717 ETL_OR_STD::pair<iterator, iterator> equal_range(const K& key)
718 {
719 return refmap_t::equal_range(key);
720 }
721#endif
722
723 //*********************************************************************
727 //*********************************************************************
728 ETL_OR_STD::pair<const_iterator, const_iterator> equal_range(const_key_reference key) const
729 {
730 return refmap_t::equal_range(key);
731 }
732
733#if ETL_USING_CPP11
734 //*********************************************************************
735 template <typename K, typename KC = TKeyCompare, etl::enable_if_t<comparator_is_transparent<KC>::value, int> = 0>
736 ETL_OR_STD::pair<const_iterator, const_iterator> equal_range(const K& key) const
737 {
738 return refmap_t::equal_range(key);
739 }
740#endif
741
742 //*************************************************************************
744 //*************************************************************************
745 bool contains(const_key_reference key) const
746 {
747 return find(key) != end();
748 }
749
750#if ETL_USING_CPP11
751 //*************************************************************************
752 template <typename K, typename KC = TKeyCompare, etl::enable_if_t<comparator_is_transparent<KC>::value, int> = 0>
753 bool contains(const K& k) const
754 {
755 return find(k) != end();
756 }
757#endif
758
759 //*************************************************************************
761 //*************************************************************************
763 {
764 if (&rhs != this)
765 {
766 assign(rhs.cbegin(), rhs.cend());
767 }
768
769 return *this;
770 }
771
772#if ETL_USING_CPP11
773 //*************************************************************************
775 //*************************************************************************
777 {
778 move_container(etl::move(rhs));
779
780 return *this;
781 }
782#endif
783
784 //*************************************************************************
787 //*************************************************************************
788 size_type size() const
789 {
790 return refmap_t::size();
791 }
792
793 //*************************************************************************
796 //*************************************************************************
797 bool empty() const
798 {
799 return refmap_t::empty();
800 }
801
802 //*************************************************************************
805 //*************************************************************************
806 bool full() const
807 {
808 return refmap_t::full();
809 }
810
811 //*************************************************************************
814 //*************************************************************************
815 size_type capacity() const
816 {
817 return refmap_t::capacity();
818 }
819
820 //*************************************************************************
823 //*************************************************************************
824 size_type max_size() const
825 {
826 return refmap_t::max_size();
827 }
828
829 //*************************************************************************
832 //*************************************************************************
833 size_t available() const
834 {
835 return refmap_t::available();
836 }
837
838 protected:
839
840 //*********************************************************************
842 //*********************************************************************
843 iflat_multimap(lookup_t& lookup_, storage_t& storage_)
844 : refmap_t(lookup_),
845 storage(storage_)
846 {
847 }
848
849#if ETL_USING_CPP11
850 //*************************************************************************
853 //*************************************************************************
854 void move_container(iflat_multimap&& rhs)
855 {
856 if (&rhs != this)
857 {
858 this->clear();
859
862
863 // Move all of the elements.
864 while (first != last)
865 {
867 ++temp;
868
869 this->insert(etl::move(*first));
870 first = temp;
871 }
872 }
873 }
874#endif
875
876 private:
877
878 // Disable copy construction.
880
881 storage_t& storage;
882
884 ETL_DECLARE_DEBUG_COUNT
885
886 //*************************************************************************
888 //*************************************************************************
889#if defined(ETL_POLYMORPHIC_FLAT_MULTIMAP) || defined(ETL_POLYMORPHIC_CONTAINERS)
890 public:
891 virtual ~iflat_multimap()
892 {
893 }
894#else
895 protected:
897 {
898 }
899#endif
900 };
901
902 //***************************************************************************
908 //***************************************************************************
909 template <typename TKey, typename TMapped, typename TKeyCompare>
911 {
912 return (lhs.size() == rhs.size()) && etl::equal(lhs.begin(), lhs.end(), rhs.begin());
913 }
914
915 //***************************************************************************
921 //***************************************************************************
922 template <typename TKey, typename TMapped, typename TKeyCompare>
924 {
925 return !(lhs == rhs);
926 }
927
928 //***************************************************************************
935 //***************************************************************************
936 template <typename TKey, typename TValue, const size_t MAX_SIZE_, typename TCompare = etl::less<TKey> >
937 class flat_multimap : public etl::iflat_multimap<TKey, TValue, TCompare>
938 {
939 public:
940
941 static ETL_CONSTANT size_t MAX_SIZE = MAX_SIZE_;
942
943 //*************************************************************************
945 //*************************************************************************
947 : etl::iflat_multimap<TKey, TValue, TCompare>(lookup, storage)
948 {
949 }
950
951 //*************************************************************************
953 //*************************************************************************
955 : etl::iflat_multimap<TKey, TValue, TCompare>(lookup, storage)
956 {
957 this->assign(other.cbegin(), other.cend());
958 }
959
960#if ETL_USING_CPP11
961 //*************************************************************************
963 //*************************************************************************
965 : etl::iflat_multimap<TKey, TValue, TCompare>(lookup, storage)
966 {
967 if (&other != this)
968 {
969 this->move_container(etl::move(other));
970 }
971 }
972#endif
973
974 //*************************************************************************
979 //*************************************************************************
980 template <typename TIterator>
981 flat_multimap(TIterator first, TIterator last)
982 : etl::iflat_multimap<TKey, TValue, TCompare>(lookup, storage)
983 {
984 this->assign(first, last);
985 }
986
987#if ETL_HAS_INITIALIZER_LIST
988 //*************************************************************************
990 //*************************************************************************
991 flat_multimap(std::initializer_list<typename etl::iflat_multimap<TKey, TValue, TCompare>::value_type> init)
992 : etl::iflat_multimap<TKey, TValue, TCompare>(lookup, storage)
993 {
994 this->assign(init.begin(), init.end());
995 }
996#endif
997
998 //*************************************************************************
1000 //*************************************************************************
1002 {
1003 this->clear();
1004 }
1005
1006 //*************************************************************************
1008 //*************************************************************************
1010 {
1011 if (&rhs != this)
1012 {
1013 this->assign(rhs.cbegin(), rhs.cend());
1014 }
1015
1016 return *this;
1017 }
1018
1019#if ETL_USING_CPP11
1020 //*************************************************************************
1022 //*************************************************************************
1024 {
1025 if (&rhs != this)
1026 {
1027 this->move_container(etl::move(rhs));
1028 }
1029
1030 return *this;
1031 }
1032#endif
1033
1034 private:
1035
1036 typedef typename etl::iflat_multimap<TKey, TValue, TCompare>::value_type node_t;
1037
1038 // The pool of nodes.
1040
1041 // The vector that stores pointers to the nodes.
1043 };
1044
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;
1047
1048 //*************************************************************************
1050 //*************************************************************************
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,
1054 typename etl::nth_type_t<0, TPairs...>::second_type,
1055 sizeof...(TPairs)>;
1056#endif
1057
1058 //*************************************************************************
1060 //*************************************************************************
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>
1064 {
1065 return { {etl::forward<TPairs>(pairs)...} };
1066 }
1067#endif
1068}
1069
1070#endif
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: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()
Internal debugging.
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 T * addressof(T &t)
Definition: addressof.h:51
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
Definition: ipool.h:102
bitset_ext
Definition: absolute.h:38
bool operator!=(const etl::array< T, SIZE > &lhs, const etl::array< T, SIZE > &rhs)
Definition: array.h:645
bool operator==(const etl::array< T, SIZE > &lhs, const etl::array< T, SIZE > &rhs)
Definition: array.h:633
Definition: type_traits_generator.h:2055
iterator
Definition: iterator.h:399