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