Stroika Library 3.0d16
 
Loading...
Searching...
No Matches
SortedCollection_stdmultiset.h
Go to the documentation of this file.
1/*
2 * Copyright(c) Sophist Solutions, Inc. 1990-2025. All rights reserved
3 */
4
5// Moved #includes outside #include guard to avoid deadly embrace
6#include "Stroika/Foundation/StroikaPreComp.h"
7
8#include <set>
9
11
12#ifndef _Stroika_Foundation_Containers_Concrete_SortedCollection_stdmultiset_h_
13#define _Stroika_Foundation_Containers_Concrete_SortedCollection_stdmultiset_h_
14
15/**
16 * \file
17 *
18 * \note Code-Status: <a href="Code-Status.md#Beta">Beta</a>
19 */
20
22
23 /**
24 * \brief SortedCollection_stdmultiset<T> is an stdmultiset-based concrete implementation of the SortedCollection<T> container pattern.
25 *
26 * \note Runtime performance/complexity:
27 * o size () is O(1)
28 * o Uses Memory::UseBlockAllocationIfAppropriate
29 * o Additions and Removals are O(log N)
30 *
31 * \note \em Thread-Safety <a href="Thread-Safety.md#C++-Standard-Thread-Safety">C++-Standard-Thread-Safety</a>
32 */
33 template <typename T>
35 private:
37
38 public:
39 using value_type = typename inherited::value_type;
40 using ElementThreeWayComparerType = typename SortedCollection<T>::ElementThreeWayComparerType;
41
42 public:
43 /**
44 */
45 template <Common::IInOrderComparer<T> INORDER_COMPARER = less<T>>
46 using STDMULTISET =
47 multiset<value_type, INORDER_COMPARER, Memory::BlockAllocatorOrStdAllocatorAsAppropriate<value_type, sizeof (value_type) <= 1024>>;
48
49 public:
50 /**
51 * \see docs on SortedCollection<> constructor
52 */
54 template <Common::IInOrderComparer<T> INORDER_COMPARER>
55 explicit SortedCollection_stdmultiset (INORDER_COMPARER&& inorderComparer);
58 SortedCollection_stdmultiset (const initializer_list<T>& src);
59 template <Common::IInOrderComparer<T> INORDER_COMPARER>
60 SortedCollection_stdmultiset (INORDER_COMPARER&& inOrderComparer, const initializer_list<T>& src);
61 template <IIterableOfTo<T> ITERABLE_OF_ADDABLE>
62 requires (not derived_from<remove_cvref_t<ITERABLE_OF_ADDABLE>, SortedCollection_stdmultiset<T>>)
63 explicit SortedCollection_stdmultiset (ITERABLE_OF_ADDABLE&& src)
64#if qCompilerAndStdLib_RequiresNotMatchInlineOutOfLineForTemplateClassBeingDefined_Buggy
66 {
67 this->AddAll (forward<ITERABLE_OF_ADDABLE> (src));
68 AssertRepValidType_ ();
69 }
70#endif
71 ;
72 template <Common::IInOrderComparer<T> INORDER_COMPARER, IIterableOfTo<T> ITERABLE_OF_ADDABLE>
73 SortedCollection_stdmultiset (INORDER_COMPARER&& inOrderComparer, ITERABLE_OF_ADDABLE&& src);
74 template <IInputIterator<T> ITERATOR_OF_ADDABLE>
75 SortedCollection_stdmultiset (ITERATOR_OF_ADDABLE&& start, ITERATOR_OF_ADDABLE&& end);
76 template <Common::IInOrderComparer<T> INORDER_COMPARER, IInputIterator<T> ITERATOR_OF_ADDABLE>
77 SortedCollection_stdmultiset (INORDER_COMPARER&& inOrderComparer, ITERATOR_OF_ADDABLE&& start, ITERATOR_OF_ADDABLE&& end);
78
79 public:
80 /**
81 */
82 nonvirtual SortedCollection_stdmultiset& operator= (SortedCollection_stdmultiset&&) noexcept = default;
83 nonvirtual SortedCollection_stdmultiset& operator= (const SortedCollection_stdmultiset&) = default;
84
85 private:
86 using IImplRepBase_ = typename SortedCollection<T>::_IRep;
87 template <qCompilerAndStdLib_ConstraintDiffersInTemplateRedeclaration_BWA (Common::IInOrderComparer<T>) INORDER_COMPARER>
88 class Rep_;
89
90 private:
91 nonvirtual void AssertRepValidType_ () const;
92 };
93
94}
95
96/*
97 ********************************************************************************
98 ******************************* Implementation Details *************************
99 ********************************************************************************
100 */
101#include "SortedCollection_stdmultiset.inl"
102
103#endif /*_Stroika_Foundation_Containers_Concrete_SortedCollection_stdmultiset_h_ */
conditional_t< qStroika_Foundation_Memory_PreferBlockAllocation and andTrueCheck, BlockAllocator< T >, std::allocator< T > > BlockAllocatorOrStdAllocatorAsAppropriate
for type T, either use BlockAllocator<T>, or std::allocator
nonvirtual void AddAll(ITERATOR_OF_ADDABLE &&start, ITERATOR_OF_ADDABLE2 &&end)
typename inherited::value_type value_type
Definition Collection.h:116
SortedCollection_stdmultiset<T> is an stdmultiset-based concrete implementation of the SortedCollecti...
Implementation detail for SortedCollection<T> implementors.
A SortedCollection is a Collection<T> which remains sorted (iteration produces items sorted) even as ...
static constexpr default_sentinel_t end() noexcept
Support for ranged for, and STL syntax in general.