18 requires (ITotallyOrderingComparer<less<T>, T>)
21 _AssertRepValidType ();
24 template <ITotallyOrderingComparer<T> COMPARER>
25 inline SortedCollection<T>::SortedCollection (COMPARER&& comparer)
26 : inherited{Factory::SortedCollection_Factory<T, remove_cvref_t<COMPARER>> () (forward<COMPARER> (comparer))}
28 _AssertRepValidType ();
35 _AssertRepValidType ();
41 _AssertRepValidType ();
45 requires (ITotallyOrderingComparer<less<T>, T>)
49 _AssertRepValidType ();
52 template <ITotallyOrderingComparer<T> COMPARER>
54 : SortedCollection{forward<COMPARER> (comparer)}
57 _AssertRepValidType ();
59#if !qCompilerAndStdLib_RequiresNotMatchInlineOutOfLineForTemplateClassBeingDefined_Buggy
61 template <IIterableOfTo<T> ITERABLE_OF_ADDABLE>
63 requires (ITotallyOrderingComparer<less<T>, T> and not derived_from<remove_cvref_t<ITERABLE_OF_ADDABLE>, SortedCollection<T>>)
66 this->AddAll (forward<ITERABLE_OF_ADDABLE> (src));
67 _AssertRepValidType ();
71 template <ITotallyOrderingComparer<T> COMPARER, IIterableOfTo<T> ITERABLE_OF_ADDABLE>
73 : SortedCollection{forward<COMPARER> (comparer)}
75 this->
AddAll (forward<ITERABLE_OF_ADDABLE> (src));
76 _AssertRepValidType ();
79 template <IInputIterator<T> ITERATOR_OF_ADDABLE>
81 requires (ITotallyOrderingComparer<less<T>, T>)
84 this->AddAll (forward<ITERATOR_OF_ADDABLE> (start), forward<ITERATOR_OF_ADDABLE> (end));
85 _AssertRepValidType ();
88 template <ITotallyOrderingComparer<T> COMPARER, IInputIterator<T> ITERATOR_OF_ADDABLE>
90 : SortedCollection{forward<COMPARER> (comparer)}
92 this->
AddAll (forward<ITERATOR_OF_ADDABLE> (start), forward<ITERATOR_OF_ADDABLE> (
end));
93 _AssertRepValidType ();
96 inline void SortedCollection<T>::_AssertRepValidType ()
const
99 _SafeReadRepAccessor<_IRep>{
this};
102 template <
typename T>
106 _SafeReadRepAccessor<_IRep>{
this}._ConstGetRep ().GetElementThreeWayComparer ()};
108 template <
typename T>
111 return _SafeReadRepAccessor<_IRep>{
this}._ConstGetRep ().GetElementThreeWayComparer ();
113 template <
typename T>
116 return _SafeReadRepAccessor<_IRep>{
this}._ConstGetRep ().Contains (item);
118 template <
typename T>
121 _SafeReadWriteRepAccessor<_IRep>{
this}._GetWriteableRep ().Remove (item);
123 template <
typename T>
124 template <
typename RESULT_CONTAINER, invocable<T> ELEMENT_MAPPER>
126 requires (convertible_to<invoke_result_t<ELEMENT_MAPPER, T>,
typename RESULT_CONTAINER::value_type> or
127 convertible_to<invoke_result_t<ELEMENT_MAPPER, T>, optional<typename RESULT_CONTAINER::value_type>>)
129 if constexpr (same_as<RESULT_CONTAINER, SortedCollection>) {
131 return inherited::template Map<RESULT_CONTAINER> (forward<ELEMENT_MAPPER> (elementMapper),
132 RESULT_CONTAINER{_SafeReadRepAccessor<_IRep>{
this}._ConstGetRep ().CloneEmpty ()});
135 return inherited::template Map<RESULT_CONTAINER> (forward<ELEMENT_MAPPER> (elementMapper));
138 template <
typename T>
139 template <derived_from<Iterable<T>> RESULT_CONTAINER, predicate<T> INCLUDE_PREDICATE>
142 if constexpr (same_as<RESULT_CONTAINER, SortedCollection>) {
144 return inherited::template Where<RESULT_CONTAINER> (
145 forward<INCLUDE_PREDICATE> (includeIfTrue), RESULT_CONTAINER{_SafeReadRepAccessor<_IRep>{
this}._ConstGetRep ().CloneEmpty ()});
148 return inherited::template Where<RESULT_CONTAINER> (forward<INCLUDE_PREDICATE> (includeIfTrue));
151 template <
typename T>
158 template <
typename T>
#define qStroika_Foundation_Debug_AssertionsChecked
The qStroika_Foundation_Debug_AssertionsChecked flag determines if assertions are checked and validat...
#define RequireNotNull(p)
#define RequireExpression(c)
nonvirtual void AddAll(ITERATOR_OF_ADDABLE &&start, ITERATOR_OF_ADDABLE2 &&end)
A SortedCollection is a Collection<T> which remains sorted (iteration produces items sorted) even as ...
nonvirtual ElementInOrderComparerType GetInOrderComparer() const
nonvirtual strong_ordering operator<=>(const SortedCollection &rhs) const
nonvirtual RESULT_CONTAINER Map(ELEMENT_MAPPER &&elementMapper) const
'override' Iterable<>::Map () function so RESULT_CONTAINER defaults to SortedCollection,...
nonvirtual ElementThreeWayComparerType GetElementThreeWayComparer() const
nonvirtual bool operator==(const SortedCollection &rhs) const
nonvirtual RESULT_CONTAINER Where(INCLUDE_PREDICATE &&includeIfTrue) const
subset of this SortedCollection matching filter-function
nonvirtual bool Contains(ArgByValueType< T > item) const
Compares items with the already associated GetInOrderComparer(), and returns true if the item is foun...
Iterable<T> is a base class for containers which easily produce an Iterator<T> to traverse them.
static constexpr default_sentinel_t end() noexcept
Support for ranged for, and STL syntax in general.
Use this to wrap any basic comparer, and produce an Equals comparer.
Use this to wrap any basic comparer, and produce a Less comparer.
Use this to wrap a basic (ITotallyOrderingComparer) comparer, and produce a Three-Way comparer.