Embedded Template Library 1.0
Loading...
Searching...
No Matches
flat_multiset.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_MULTISET_INCLUDED
32#define ETL_FLAT_MULTISET_INCLUDED
33
34#include "platform.h"
35#include "initializer_list.h"
36#include "nth_type.h"
37#include "placement_new.h"
38#include "pool.h"
40#include "type_traits.h"
41
43
44//*****************************************************************************
50//*****************************************************************************
51
52namespace etl
53{
54 //***************************************************************************
59 //***************************************************************************
60 template <typename T, typename TKeyCompare = etl::less<T> >
61 class iflat_multiset : private etl::ireference_flat_multiset<T, TKeyCompare>
62 {
63 private:
64
66 typedef typename refset_t::lookup_t lookup_t;
67 typedef etl::ipool storage_t;
68
69 typedef const T& key_parameter_t;
70
71 public:
72
73 typedef T key_type;
74 typedef T value_type;
75 typedef TKeyCompare key_compare;
76 typedef value_type& reference;
77 typedef const value_type& const_reference;
78#if ETL_USING_CPP11
79 typedef value_type&& rvalue_reference;
80#endif
81 typedef value_type* pointer;
82 typedef const value_type* const_pointer;
83 typedef size_t size_type;
84
85 typedef typename refset_t::iterator iterator;
86 typedef typename refset_t::const_iterator const_iterator;
87
88 typedef ETL_OR_STD::reverse_iterator<iterator> reverse_iterator;
89 typedef ETL_OR_STD::reverse_iterator<const_iterator> const_reverse_iterator;
90 typedef typename etl::iterator_traits<iterator>::difference_type difference_type;
91
92 public:
93
94 //*********************************************************************
97 //*********************************************************************
98 iterator begin()
99 {
100 return refset_t::begin();
101 }
102
103 //*********************************************************************
106 //*********************************************************************
107 const_iterator begin() const
108 {
109 return refset_t::begin();
110 }
111
112 //*********************************************************************
115 //*********************************************************************
116 iterator end()
117 {
118 return refset_t::end();
119 }
120
121 //*********************************************************************
124 //*********************************************************************
125 const_iterator end() const
126 {
127 return refset_t::end();
128 }
129
130 //*********************************************************************
133 //*********************************************************************
134 const_iterator cbegin() const
135 {
136 return refset_t::cbegin();
137 }
138
139 //*********************************************************************
142 //*********************************************************************
143 const_iterator cend() const
144 {
145 return refset_t::cend();
146 }
147
148 //*********************************************************************
152 //*********************************************************************
153 reverse_iterator rbegin()
154 {
155 return refset_t::rbegin();
156 }
157
158 //*********************************************************************
162 //*********************************************************************
163 const_reverse_iterator rbegin() const
164 {
165 return refset_t::rbegin();
166 }
167
168 //*********************************************************************
171 //*********************************************************************
172 reverse_iterator rend()
173 {
174 return refset_t::rend();
175 }
176
177 //*********************************************************************
180 //*********************************************************************
181 const_reverse_iterator rend() const
182 {
183 return refset_t::rend();
184 }
185
186 //*********************************************************************
191 //*********************************************************************
192 const_reverse_iterator crbegin() const
193 {
194 return refset_t::crbegin();
195 }
196
197 //*********************************************************************
200 //*********************************************************************
201 const_reverse_iterator crend() const
202 {
203 return refset_t::crend();
204 }
205
206 //*********************************************************************
213 //*********************************************************************
214 template <typename TIterator>
215 void assign(TIterator first, TIterator last)
216 {
217#if ETL_IS_DEBUG_BUILD
218 difference_type d = etl::distance(first, last);
219 ETL_ASSERT(d <= difference_type(capacity()), ETL_ERROR(flat_multiset_full));
220#endif
221
222 clear();
223
224 while (first != last)
225 {
226 insert(*first);
227 ++first;
228 }
229 }
230
231 //*********************************************************************
236 //*********************************************************************
237 ETL_OR_STD::pair<iterator, bool> insert(const_reference value)
238 {
239 ETL_OR_STD::pair<iterator, bool> result(end(), false);
240
241 ETL_ASSERT(!full(), ETL_ERROR(flat_multiset_full));
242
243 iterator i_element = etl::upper_bound(begin(), end(), value, compare);
244
245 value_type* pvalue = storage.allocate<value_type>();
246 ::new (pvalue) value_type(value);
247 ETL_INCREMENT_DEBUG_COUNT;
248 result = refset_t::insert_at(i_element, *pvalue);
249
250 return result;
251 }
252
253#if ETL_USING_CPP11
254 //*********************************************************************
259 //*********************************************************************
260 ETL_OR_STD::pair<iterator, bool> insert(rvalue_reference value)
261 {
262 ETL_OR_STD::pair<iterator, bool> result(end(), false);
263
264 ETL_ASSERT(!full(), ETL_ERROR(flat_multiset_full));
265
266 iterator i_element = etl::upper_bound(begin(), end(), value, compare);
267
268 value_type* pvalue = storage.allocate<value_type>();
269 ::new (pvalue) value_type(etl::move(value));
270 ETL_INCREMENT_DEBUG_COUNT;
271 result = refset_t::insert_at(i_element, *pvalue);
272
273 return result;
274 }
275#endif
276
277 //*********************************************************************
283 //*********************************************************************
284 iterator insert(const_iterator /*position*/, const_reference value)
285 {
286 return insert(value).first;
287 }
288
289#if ETL_USING_CPP11
290 //*********************************************************************
296 //*********************************************************************
297 iterator insert(const_iterator /*position*/, rvalue_reference value)
298 {
299 return insert(etl::move(value)).first;
300 }
301#endif
302
303 //*********************************************************************
310 //*********************************************************************
311 template <class TIterator>
312 void insert(TIterator first, TIterator last)
313 {
314 while (first != last)
315 {
316 insert(*first);
317 ++first;
318 }
319 }
320
321 //*************************************************************************
323 //*************************************************************************
324 template <typename T1>
325 ETL_OR_STD::pair<iterator, bool> emplace(const_reference value)
326 {
327 return insert(value);
328 }
329
330 //*************************************************************************
332 //*************************************************************************
333#if ETL_USING_CPP11 && ETL_NOT_USING_STLPORT && !defined(ETL_FLAT_MULTISET_FORCE_CPP03_IMPLEMENTATION)
334 template <typename... Args>
335 ETL_OR_STD::pair<iterator, bool> emplace(Args&&... args)
336 {
337 ETL_ASSERT(!full(), ETL_ERROR(flat_multiset_full));
338
339 // Create it.
340 value_type* pvalue = storage.allocate<value_type>();
341 ::new (pvalue) value_type(etl::forward<Args>(args)...);
342
343 iterator i_element = upper_bound(*pvalue);
344
345 ETL_INCREMENT_DEBUG_COUNT;
346 return ETL_OR_STD::pair<iterator, bool>(refset_t::insert_at(i_element, *pvalue));
347 }
348#else
349 //*************************************************************************
351 //*************************************************************************
352 ETL_OR_STD::pair<iterator, bool> emplace()
353 {
354 ETL_ASSERT(!full(), ETL_ERROR(flat_multiset_full));
355
356 // Create it.
357 value_type* pvalue = storage.allocate<value_type>();
358 ::new (pvalue) value_type();
359
360 iterator i_element = upper_bound(*pvalue);
361
362 ETL_INCREMENT_DEBUG_COUNT;
363 return ETL_OR_STD::pair<iterator, bool>(refset_t::insert_at(i_element, *pvalue));
364 }
365
366 //*************************************************************************
368 //*************************************************************************
369 template <typename T1>
370 ETL_OR_STD::pair<iterator, bool> emplace(const T1& value1)
371 {
372 ETL_ASSERT(!full(), ETL_ERROR(flat_multiset_full));
373
374 // Create it.
375 value_type* pvalue = storage.allocate<value_type>();
376 ::new (pvalue) value_type(value1);
377
378 iterator i_element = upper_bound(*pvalue);
379
380 ETL_INCREMENT_DEBUG_COUNT;
381 return ETL_OR_STD::pair<iterator, bool>(refset_t::insert_at(i_element, *pvalue));
382 }
383
384 //*************************************************************************
386 //*************************************************************************
387 template <typename T1, typename T2>
388 ETL_OR_STD::pair<iterator, bool> emplace(const T1& value1, const T2& value2)
389 {
390 ETL_ASSERT(!full(), ETL_ERROR(flat_multiset_full));
391
392 // Create it.
393 value_type* pvalue = storage.allocate<value_type>();
394 ::new (pvalue) value_type(value1, value2);
395
396 iterator i_element = upper_bound(*pvalue);
397
398 ETL_INCREMENT_DEBUG_COUNT;
399 return ETL_OR_STD::pair<iterator, bool>(refset_t::insert_at(i_element, *pvalue));
400 }
401
402 //*************************************************************************
404 //*************************************************************************
405 template <typename T1, typename T2, typename T3>
406 ETL_OR_STD::pair<iterator, bool> emplace(const T1& value1, const T2& value2, const T3& value3)
407 {
408 ETL_ASSERT(!full(), ETL_ERROR(flat_multiset_full));
409
410 // Create it.
411 value_type* pvalue = storage.allocate<value_type>();
412 ::new (pvalue) value_type(value1, value2, value3);
413
414 iterator i_element = upper_bound(*pvalue);
415
416 ETL_INCREMENT_DEBUG_COUNT;
417 return ETL_OR_STD::pair<iterator, bool>(refset_t::insert_at(i_element, *pvalue));
418 }
419
420 //*************************************************************************
422 //*************************************************************************
423 template <typename T1, typename T2, typename T3, typename T4>
424 ETL_OR_STD::pair<iterator, bool> emplace(const T1& value1, const T2& value2, const T3& value3, const T4& value4)
425 {
426 ETL_ASSERT(!full(), ETL_ERROR(flat_multiset_full));
427
428 // Create it.
429 value_type* pvalue = storage.allocate<value_type>();
430 ::new (pvalue) value_type(value1, value2, value3, value4);
431
432 iterator i_element = upper_bound(*pvalue);
433
434 ETL_INCREMENT_DEBUG_COUNT;
435 return ETL_OR_STD::pair<iterator, bool>(refset_t::insert_at(i_element, *pvalue));
436 }
437#endif
438
439 //*********************************************************************
443 //*********************************************************************
444 size_t erase(key_parameter_t key)
445 {
446 ETL_OR_STD::pair<iterator, iterator> range = equal_range(key);
447
448 if (range.first == end())
449 {
450 return 0;
451 }
452 else
453 {
454 size_t d = static_cast<size_t>(etl::distance(range.first, range.second));
455 erase(range.first, range.second);
456 return d;
457 }
458 }
459
460#if ETL_USING_CPP11
461 //*********************************************************************
462 template <typename K, typename KC = TKeyCompare, etl::enable_if_t<comparator_is_transparent<KC>::value, int> = 0>
463 size_t erase(K&& key)
464 {
465 ETL_OR_STD::pair<iterator, iterator> range = equal_range(etl::forward<K>(key));
466
467 if (range.first == end())
468 {
469 return 0;
470 }
471 else
472 {
473 size_t d = static_cast<size_t>(etl::distance(range.first, range.second));
474 erase(range.first, range.second);
475 return d;
476 }
477 }
478#endif
479
480 //*********************************************************************
483 //*********************************************************************
484 iterator erase(iterator i_element)
485 {
486 etl::destroy_at(etl::addressof(*i_element));
487 storage.release(etl::addressof(*i_element));
488 ETL_DECREMENT_DEBUG_COUNT;
489 return refset_t::erase(i_element);
490 }
491
492 //*********************************************************************
495 //*********************************************************************
496 iterator erase(const_iterator i_element)
497 {
498 etl::destroy_at(etl::addressof(*i_element));
499 storage.release(etl::addressof(*i_element));
500 ETL_DECREMENT_DEBUG_COUNT;
501 return refset_t::erase(i_element);
502 }
503
504 //*********************************************************************
510 //*********************************************************************
511 iterator erase(const_iterator first, const_iterator last)
512 {
513 const_iterator itr = first;
514
515 while (itr != last)
516 {
518 storage.release(etl::addressof(*itr));
519 ++itr;
520 ETL_DECREMENT_DEBUG_COUNT;
521 }
522
523 return refset_t::erase(first, last);
524 }
525
526 //*************************************************************************
528 //*************************************************************************
529 void clear()
530 {
531 if ETL_IF_CONSTEXPR (etl::is_trivially_destructible<value_type>::value)
532 {
533 storage.release_all();
534 }
535 else
536 {
537 iterator itr = begin();
538
539 while (itr != end())
540 {
542 storage.release(etl::addressof(*itr));
543 ++itr;
544 }
545 }
546
547 ETL_RESET_DEBUG_COUNT;
549 }
550
551 //*********************************************************************
555 //*********************************************************************
556 iterator find(key_parameter_t key)
557 {
558 return refset_t::find(key);
559 }
560
561#if ETL_USING_CPP11
562 //*********************************************************************
563 template <typename K, typename KC = TKeyCompare, etl::enable_if_t<comparator_is_transparent<KC>::value, int> = 0>
564 iterator find(const K& key)
565 {
566 return refset_t::find(key);
567 }
568#endif
569
570 //*********************************************************************
574 //*********************************************************************
575 const_iterator find(key_parameter_t key) const
576 {
577 return refset_t::find(key);
578 }
579
580#if ETL_USING_CPP11
581 //*********************************************************************
582 template <typename K, typename KC = TKeyCompare, etl::enable_if_t<comparator_is_transparent<KC>::value, int> = 0>
583 const_iterator find(const K& key) const
584 {
585 return refset_t::find(key);
586 }
587#endif
588
589 //*********************************************************************
593 //*********************************************************************
594 size_t count(key_parameter_t key) const
595 {
596 return refset_t::count(key);
597 }
598
599#if ETL_USING_CPP11
600 //*********************************************************************
601 template <typename K, typename KC = TKeyCompare, etl::enable_if_t<comparator_is_transparent<KC>::value, int> = 0>
602 size_t count(const K& key) const
603 {
604 return refset_t::count(key);
605 }
606#endif
607
608 //*********************************************************************
612 //*********************************************************************
613 iterator lower_bound(key_parameter_t key)
614 {
615 return refset_t::lower_bound(key);
616 }
617
618#if ETL_USING_CPP11
619 //*********************************************************************
620 template <typename K, typename KC = TKeyCompare, etl::enable_if_t<comparator_is_transparent<KC>::value, int> = 0>
621 iterator lower_bound(const K& key)
622 {
623 return refset_t::lower_bound(key);
624 }
625#endif
626
627 //*********************************************************************
631 //*********************************************************************
632 const_iterator lower_bound(key_parameter_t key) const
633 {
634 return refset_t::lower_bound(key);
635 }
636
637#if ETL_USING_CPP11
638 //*********************************************************************
639 template <typename K, typename KC = TKeyCompare, etl::enable_if_t<comparator_is_transparent<KC>::value, int> = 0>
640 const_iterator lower_bound(const K& key) const
641 {
642 return refset_t::lower_bound(key);
643 }
644#endif
645
646 //*********************************************************************
650 //*********************************************************************
651 iterator upper_bound(key_parameter_t key)
652 {
653 return refset_t::upper_bound(key);
654 }
655
656#if ETL_USING_CPP11
657 //*********************************************************************
658 template <typename K, typename KC = TKeyCompare, etl::enable_if_t<comparator_is_transparent<KC>::value, int> = 0>
659 iterator upper_bound(const K& key)
660 {
661 return refset_t::upper_bound(key);
662 }
663#endif
664
665 //*********************************************************************
669 //*********************************************************************
670 const_iterator upper_bound(key_parameter_t key) const
671 {
672 return refset_t::upper_bound(key);
673 }
674
675#if ETL_USING_CPP11
676 //*********************************************************************
677 template <typename K, typename KC = TKeyCompare, etl::enable_if_t<comparator_is_transparent<KC>::value, int> = 0>
678 const_iterator upper_bound(const K& key) const
679 {
680 return refset_t::upper_bound(key);
681 }
682#endif
683
684 //*********************************************************************
688 //*********************************************************************
689 ETL_OR_STD::pair<iterator, iterator> equal_range(key_parameter_t key)
690 {
691 return refset_t::equal_range(key);
692 }
693
694#if ETL_USING_CPP11
695 //*********************************************************************
696 template <typename K, typename KC = TKeyCompare, etl::enable_if_t<comparator_is_transparent<KC>::value, int> = 0>
697 ETL_OR_STD::pair<iterator, iterator> equal_range(const K& key)
698 {
699 return refset_t::equal_range(key);
700 }
701#endif
702
703 //*********************************************************************
707 //*********************************************************************
708 ETL_OR_STD::pair<const_iterator, const_iterator> equal_range(key_parameter_t key) const
709 {
710 return refset_t::equal_range(key);
711 }
712
713#if ETL_USING_CPP11
714 //*********************************************************************
715 template <typename K, typename KC = TKeyCompare, etl::enable_if_t<comparator_is_transparent<KC>::value, int> = 0>
716 ETL_OR_STD::pair<const_iterator, const_iterator> equal_range(const K& key) const
717 {
718 return refset_t::equal_range(key);
719 }
720#endif
721
722 //*************************************************************************
724 //*************************************************************************
725 bool contains(key_parameter_t key) const
726 {
727 return find(key) != end();
728 }
729
730#if ETL_USING_CPP11
731 //*************************************************************************
732 template <typename K, typename KC = TKeyCompare, etl::enable_if_t<comparator_is_transparent<KC>::value, int> = 0>
733 bool contains(const K& k) const
734 {
735 return find(k) != end();
736 }
737#endif
738
739 //*************************************************************************
741 //*************************************************************************
743 {
744 if (&rhs != this)
745 {
746 assign(rhs.cbegin(), rhs.cend());
747 }
748
749 return *this;
750 }
751
752#if ETL_USING_CPP11
753 //*************************************************************************
755 //*************************************************************************
757 {
758 move_container(etl::move(rhs));
759
760 return *this;
761 }
762#endif
763
764 //*************************************************************************
767 //*************************************************************************
768 size_type size() const
769 {
770 return refset_t::size();
771 }
772
773 //*************************************************************************
776 //*************************************************************************
777 bool empty() const
778 {
779 return refset_t::empty();
780 }
781
782 //*************************************************************************
785 //*************************************************************************
786 bool full() const
787 {
788 return refset_t::full();
789 }
790
791 //*************************************************************************
794 //*************************************************************************
795 size_type capacity() const
796 {
797 return refset_t::capacity();
798 }
799
800 //*************************************************************************
803 //*************************************************************************
804 size_type max_size() const
805 {
806 return refset_t::max_size();
807 }
808
809 //*************************************************************************
812 //*************************************************************************
813 size_t available() const
814 {
815 return refset_t::available();
816 }
817
818 protected:
819
820 //*********************************************************************
822 //*********************************************************************
823 iflat_multiset(lookup_t& lookup_, storage_t& storage_)
824 : refset_t(lookup_)
825 , storage(storage_)
826 {
827 }
828
829#if ETL_USING_CPP11
830 //*************************************************************************
833 //*************************************************************************
834 void move_container(iflat_multiset&& rhs)
835 {
836 if (&rhs != this)
837 {
838 this->clear();
839
840 etl::iflat_multiset<T, TKeyCompare>::iterator first = rhs.begin();
841 etl::iflat_multiset<T, TKeyCompare>::iterator last = rhs.end();
842
843 // Move all of the elements.
844 while (first != last)
845 {
846 typename etl::iflat_multiset<T, TKeyCompare>::iterator temp = first;
847 ++temp;
848
849 this->insert(etl::move(*first));
850 first = temp;
851 }
852 }
853 }
854#endif
855
856 private:
857
858 // Disable copy construction.
860
861 storage_t& storage;
862
863 TKeyCompare compare;
864
866 ETL_DECLARE_DEBUG_COUNT;
867
868 //*************************************************************************
870 //*************************************************************************
871#if defined(ETL_POLYMORPHIC_FLAT_MULTISET) || defined(ETL_POLYMORPHIC_CONTAINERS)
872
873 public:
874
875 virtual ~iflat_multiset() {}
876#else
877
878 protected:
879
881#endif
882 };
883
884 //***************************************************************************
890 //***************************************************************************
891 template <typename T, typename TKeyCompare>
893 {
894 return (lhs.size() == rhs.size()) && etl::equal(lhs.begin(), lhs.end(), rhs.begin());
895 }
896
897 //***************************************************************************
903 //***************************************************************************
904 template <typename T, typename TKeyCompare>
906 {
907 return !(lhs == rhs);
908 }
909
910 //***************************************************************************
916 //***************************************************************************
917 template <typename T, const size_t MAX_SIZE_, typename TCompare = etl::less<T> >
918 class flat_multiset : public etl::iflat_multiset<T, TCompare>
919 {
920 public:
921
922 static ETL_CONSTANT size_t MAX_SIZE = MAX_SIZE_;
923
924 //*************************************************************************
926 //*************************************************************************
928 : etl::iflat_multiset<T, TCompare>(lookup, storage)
929 {
930 }
931
932 //*************************************************************************
934 //*************************************************************************
936 : iflat_multiset<T, TCompare>(lookup, storage)
937 {
938 this->assign(other.cbegin(), other.cend());
939 }
940
941#if ETL_USING_CPP11
942 //*************************************************************************
944 //*************************************************************************
946 : etl::iflat_multiset<T, TCompare>(lookup, storage)
947 {
948 if (&other != this)
949 {
950 this->move_container(etl::move(other));
951 }
952 }
953#endif
954
955 //*************************************************************************
960 //*************************************************************************
961 template <typename TIterator>
962 flat_multiset(TIterator first, TIterator last)
963 : iflat_multiset<T, TCompare>(lookup, storage)
964 {
965 this->assign(first, last);
966 }
967
968#if ETL_HAS_INITIALIZER_LIST
969 //*************************************************************************
971 //*************************************************************************
972 flat_multiset(std::initializer_list<T> init)
973 : iflat_multiset<T, TCompare>(lookup, storage)
974 {
975 this->assign(init.begin(), init.end());
976 }
977#endif
978
979 //*************************************************************************
981 //*************************************************************************
983 {
984 this->clear();
985 }
986
987 //*************************************************************************
989 //*************************************************************************
991 {
992 if (&rhs != this)
993 {
994 this->assign(rhs.cbegin(), rhs.cend());
995 }
996
997 return *this;
998 }
999
1000#if ETL_USING_CPP11
1001 //*************************************************************************
1003 //*************************************************************************
1005 {
1006 if (&rhs != this)
1007 {
1008 this->move_container(etl::move(rhs));
1009 }
1010
1011 return *this;
1012 }
1013#endif
1014
1015 private:
1016
1017 typedef typename etl::iflat_multiset<T, TCompare>::value_type node_t;
1018
1019 // The pool of nodes.
1020 etl::pool<node_t, MAX_SIZE> storage;
1021
1022 // The vector that stores pointers to the nodes.
1023 etl::vector<node_t*, MAX_SIZE> lookup;
1024 };
1025
1026 template <typename T, const size_t MAX_SIZE_, typename TCompare>
1027 ETL_CONSTANT size_t flat_multiset<T, MAX_SIZE_, TCompare>::MAX_SIZE;
1028
1029 //*************************************************************************
1031 //*************************************************************************
1032#if ETL_USING_CPP17 && ETL_HAS_INITIALIZER_LIST
1033 template <typename... T>
1034 flat_multiset(T...) -> flat_multiset<etl::nth_type_t<0, T...>, sizeof...(T)>;
1035#endif
1036
1037 //*************************************************************************
1039 //*************************************************************************
1040#if ETL_USING_CPP11 && ETL_HAS_INITIALIZER_LIST
1041 template <typename TKey, typename TKeyCompare = etl::less<TKey>, typename... T>
1042 constexpr auto make_flat_multiset(T&&... keys) -> etl::flat_multiset<TKey, sizeof...(T), TKeyCompare>
1043 {
1044 return {etl::forward<T>(keys)...};
1045 }
1046#endif
1047} // namespace etl
1048
1049#endif
Definition reference_flat_multiset.h:71
Definition reference_flat_multiset.h:102
iterator upper_bound(parameter_t key)
Definition reference_flat_multiset.h:750
size_t count(parameter_t key) const
Definition reference_flat_multiset.h:689
ETL_OR_STD::pair< iterator, bool > insert_at(iterator i_element, reference value)
Definition reference_flat_multiset.h:898
iterator begin()
Definition reference_flat_multiset.h:307
reverse_iterator rbegin()
Definition reference_flat_multiset.h:364
size_t erase(parameter_t key)
Definition reference_flat_multiset.h:516
bool empty() const
Definition reference_flat_multiset.h:842
reverse_iterator rend()
Definition reference_flat_multiset.h:385
size_t available() const
Definition reference_flat_multiset.h:878
iterator find(parameter_t key)
Definition reference_flat_multiset.h:595
size_type size() const
Definition reference_flat_multiset.h:833
bool full() const
Definition reference_flat_multiset.h:851
void clear()
Definition reference_flat_multiset.h:585
iterator end()
Definition reference_flat_multiset.h:326
iterator lower_bound(parameter_t key)
Definition reference_flat_multiset.h:712
ETL_OR_STD::pair< iterator, iterator > equal_range(parameter_t key)
Definition reference_flat_multiset.h:788
size_type capacity() const
Definition reference_flat_multiset.h:860
const_reverse_iterator crbegin() const
Definition reference_flat_multiset.h:407
const_reverse_iterator crend() const
Definition reference_flat_multiset.h:418
const_iterator cend() const
Definition reference_flat_multiset.h:354
size_type max_size() const
Definition reference_flat_multiset.h:869
const_iterator cbegin() const
Definition reference_flat_multiset.h:345
#define ETL_ASSERT(b, e)
Definition error_handler.h:511
void clear()
Clears the flat_multiset.
Definition flat_multiset.h:529
ETL_OR_STD::pair< iterator, iterator > equal_range(key_parameter_t key)
Definition flat_multiset.h:689
const_reverse_iterator crbegin() const
Definition flat_multiset.h:192
ETL_OR_STD::pair< const_iterator, const_iterator > equal_range(key_parameter_t key) const
Definition flat_multiset.h:708
const_iterator end() const
Definition flat_multiset.h:125
iterator erase(const_iterator i_element)
Definition flat_multiset.h:496
const_reverse_iterator rbegin() const
Definition flat_multiset.h:163
const_reverse_iterator rend() const
Definition flat_multiset.h:181
iterator erase(iterator i_element)
Definition flat_multiset.h:484
flat_multiset()
Constructor.
Definition flat_multiset.h:927
iflat_multiset(lookup_t &lookup_, storage_t &storage_)
Constructor.
Definition flat_multiset.h:823
iterator begin()
Definition flat_multiset.h:98
void insert(TIterator first, TIterator last)
Definition flat_multiset.h:312
ETL_OR_STD::pair< iterator, bool > insert(const_reference value)
Definition flat_multiset.h:237
const_iterator cend() const
Definition flat_multiset.h:143
iterator erase(const_iterator first, const_iterator last)
Definition flat_multiset.h:511
iterator lower_bound(key_parameter_t key)
Definition flat_multiset.h:613
void assign(TIterator first, TIterator last)
Definition flat_multiset.h:215
ETL_OR_STD::pair< iterator, bool > emplace(const T1 &value1, const T2 &value2, const T3 &value3, const T4 &value4)
Emplaces a value to the set.
Definition flat_multiset.h:424
~iflat_multiset()
Destructor.
Definition flat_multiset.h:880
iterator find(key_parameter_t key)
Definition flat_multiset.h:556
const_iterator find(key_parameter_t key) const
Definition flat_multiset.h:575
bool contains(key_parameter_t key) const
Check if the map contains the key.
Definition flat_multiset.h:725
const_iterator lower_bound(key_parameter_t key) const
Definition flat_multiset.h:632
ETL_OR_STD::pair< iterator, bool > emplace(const T1 &value1, const T2 &value2, const T3 &value3)
Emplaces a value to the set.
Definition flat_multiset.h:406
size_t count(key_parameter_t key) const
Definition flat_multiset.h:594
reverse_iterator rend()
Definition flat_multiset.h:172
bool empty() const
Definition flat_multiset.h:777
~flat_multiset()
Destructor.
Definition flat_multiset.h:982
const_reverse_iterator crend() const
Definition flat_multiset.h:201
flat_multiset(TIterator first, TIterator last)
Definition flat_multiset.h:962
size_type max_size() const
Definition flat_multiset.h:804
ETL_OR_STD::pair< iterator, bool > emplace(const_reference value)
Emplaces a value to the set.
Definition flat_multiset.h:325
const_iterator upper_bound(key_parameter_t key) const
Definition flat_multiset.h:670
ETL_OR_STD::pair< iterator, bool > emplace(const T1 &value1)
Emplaces a value to the set.
Definition flat_multiset.h:370
size_type capacity() const
Definition flat_multiset.h:795
flat_multiset & operator=(const flat_multiset &rhs)
Assignment operator.
Definition flat_multiset.h:990
iterator end()
Definition flat_multiset.h:116
const_iterator begin() const
Definition flat_multiset.h:107
const_iterator cbegin() const
Definition flat_multiset.h:134
reverse_iterator rbegin()
Definition flat_multiset.h:153
bool full() const
Definition flat_multiset.h:786
size_t erase(key_parameter_t key)
Definition flat_multiset.h:444
iterator upper_bound(key_parameter_t key)
Definition flat_multiset.h:651
size_type size() const
Definition flat_multiset.h:768
ETL_OR_STD::pair< iterator, bool > emplace(const T1 &value1, const T2 &value2)
Emplaces a value to the set.
Definition flat_multiset.h:388
size_t available() const
Definition flat_multiset.h:813
flat_multiset(const flat_multiset &other)
Copy constructor.
Definition flat_multiset.h:935
iterator insert(const_iterator, const_reference value)
Definition flat_multiset.h:284
ETL_OR_STD::pair< iterator, bool > emplace()
Emplaces a value to the set.
Definition flat_multiset.h:352
iflat_multiset & operator=(const iflat_multiset &rhs)
Assignment operator.
Definition flat_multiset.h:742
Definition flat_multiset.h:919
Definition flat_multiset.h:62
ETL_CONSTEXPR17 etl::enable_if<!etl::is_same< T, etl::nullptr_t >::value, T >::type * addressof(T &t)
Definition addressof.h:52
etl::enable_if< etl::is_trivially_destructible< T >::value, void >::type destroy_at(T *)
Definition memory.h:1511
T * allocate()
Definition ipool.h:333
Definition ipool.h:109
bitset_ext
Definition absolute.h:40
ETL_CONSTEXPR14 bool operator==(const etl::array< T, SIZE > &lhs, const etl::array< T, SIZE > &rhs)
Definition array.h:1081
ETL_CONSTEXPR14 bool operator!=(const etl::array< T, SIZE > &lhs, const etl::array< T, SIZE > &rhs)
Definition array.h:1093
ETL_CONSTEXPR TContainer::iterator end(TContainer &container)
Definition iterator.h:997
Definition compare.h:51
iterator
Definition iterator.h:424