Stroika Library 3.0d16
 
Loading...
Searching...
No Matches
SortedCollection_SkipList.h
Go to the documentation of this file.
1/*
2 * Copyright(c) Sophist Solutions, Inc. 1990-2025. All rights reserved
3 */
4#ifndef _Stroika_Foundation_Containers_Concrete_SortedCollection_SkipList_h_
5#define _Stroika_Foundation_Containers_Concrete_SortedCollection_SkipList_h_
6
7#include "Stroika/Foundation/StroikaPreComp.h"
8
9#include "Stroika/Foundation/Containers/DataStructures/SkipList.h"
12
13/**
14 * \file
15 *
16 * \note Code-Status: <a href="Code-Status.md#Beta">Beta</a>
17 *
18 */
19
21
22 using Common::IThreeWayComparer;
23
24 /**
25 * \brief SortedCollection_SkipList<T> is an SkipList-based concrete implementation of the SortedCollection<T> container pattern.
26 *
27 * \note Runtime performance/complexity:
28 * SortedCollection_SkipList<T> is ....
29 *
30 * \note \em Thread-Safety <a href="Thread-Safety.md#C++-Standard-Thread-Safety">C++-Standard-Thread-Safety</a>
31 */
32 template <typename T>
33 class SortedCollection_SkipList : public Private::SkipListBasedContainer<SortedCollection_SkipList<T>, SortedCollection<T>, true> {
34 private:
36
37 public:
38 using value_type = typename inherited::value_type;
39 using ElementThreeWayComparerType = typename SortedCollection<T>::ElementThreeWayComparerType;
40
41 public:
42 /**
43 * AddOrExtendOrReplaceMode::eAddReplaces is the most common behavior for Mapping, so default to that in SkipList, and special case
44 * AddOrExtendOrReplaceMode::eAddIfMissing.
45 */
46 template <IThreeWayComparer<T> COMPARER = compare_three_way>
48
49 /**
50 * \brief SKIPLIST is SkipList that can be used inside SortedMapping_SkipList
51 */
52 template <IThreeWayComparer<T> COMPARER = compare_three_way>
54
55 public:
56 /**
57 * \see docs on SortedCollection<> constructor
58 */
60 template <IThreeWayComparer<T> COMPARER>
61 explicit SortedCollection_SkipList (COMPARER&& comparer);
63 SortedCollection_SkipList (const SortedCollection_SkipList&) noexcept = default;
64 SortedCollection_SkipList (const initializer_list<T>& src);
65 template <IThreeWayComparer<T> COMPARER>
66 SortedCollection_SkipList (COMPARER&& comparer, const initializer_list<T>& src);
67 template <IIterableOfTo<T> ITERABLE_OF_ADDABLE>
68 requires (not derived_from<remove_cvref_t<ITERABLE_OF_ADDABLE>, SortedCollection_SkipList<T>>)
69 explicit SortedCollection_SkipList (ITERABLE_OF_ADDABLE&& src)
70#if qCompilerAndStdLib_RequiresNotMatchInlineOutOfLineForTemplateClassBeingDefined_Buggy
72 {
73 this->AddAll (forward<ITERABLE_OF_ADDABLE> (src));
74 AssertRepValidType_ ();
75 }
76#endif
77 ;
78 template <IThreeWayComparer<T> COMPARER, IIterableOfTo<T> ITERABLE_OF_ADDABLE>
79 SortedCollection_SkipList (COMPARER&& comparer, ITERABLE_OF_ADDABLE&& src);
80 template <IInputIterator<T> ITERATOR_OF_ADDABLE>
81 SortedCollection_SkipList (ITERATOR_OF_ADDABLE&& start, ITERATOR_OF_ADDABLE&& end);
82 template <IThreeWayComparer<T> COMPARER, IInputIterator<T> ITERATOR_OF_ADDABLE>
83 SortedCollection_SkipList (COMPARER&& comparer, ITERATOR_OF_ADDABLE&& start, ITERATOR_OF_ADDABLE&& end);
84
85 public:
86 /**
87 */
88 nonvirtual SortedCollection_SkipList& operator= (SortedCollection_SkipList&&) noexcept = default;
89 nonvirtual SortedCollection_SkipList& operator= (const SortedCollection_SkipList&) = default;
90
91 private:
92 using IImplRepBase_ = Private::SkipListBasedContainerIRep<typename SortedCollection<T>::_IRep>;
93 template <qCompilerAndStdLib_ConstraintDiffersInTemplateRedeclaration_BWA (Common::IThreeWayComparer<T>) COMPARER>
94 class Rep_;
95
96 private:
97 nonvirtual void AssertRepValidType_ () const;
98
99 private:
100 friend inherited;
101 };
102
103}
104
105/*
106 ********************************************************************************
107 ******************************* Implementation Details *************************
108 ********************************************************************************
109 */
110#include "SortedCollection_SkipList.inl"
111
112#endif /*_Stroika_Foundation_Containers_Concrete_SortedCollection_SkipList_h_ */
nonvirtual void AddAll(ITERATOR_OF_ADDABLE &&start, ITERATOR_OF_ADDABLE2 &&end)
typename inherited::value_type value_type
Definition Collection.h:116
SortedCollection_SkipList<T> is an SkipList-based concrete implementation of the SortedCollection<T> ...
SkipListBasedContainer is a Stroika implementation detail, but its public methods are fair game and f...
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.