Stroika Library 3.0d16
 
Loading...
Searching...
No Matches
Set_LinkedList.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_Set_LinkedList_h_
5#define _Stroika_Foundation_Containers_Concrete_Set_LinkedList_h_
6
7#include "Stroika/Foundation/StroikaPreComp.h"
8
9#include "Stroika/Foundation/Containers/Set.h"
10
11/**
12 * \file
13 *
14 * \note Code-Status: <a href="Code-Status.md#Beta">Beta</a>
15 *
16 */
17
19
20 /**
21 * \brief Set_LinkedList<T> is an LinkedList-based concrete implementation of the Set<T> container pattern.
22 *
23 * \note Runtime performance/complexity:
24 * Set_stdset<T> is a compact representation, but ONLY reasonable for very small sets. Performance is O(N) as set grows.
25 *
26 * o size () is O(N), but empty () is constant
27 * o Uses Memory::UseBlockAllocationIfAppropriate
28 * o Additions and Removals are generally O(N)
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 Set_LinkedList : public Set<T> {
34 private:
35 using inherited = Set<T>;
36
37 public:
38 using ElementEqualityComparerType = typename inherited::ElementEqualityComparerType;
39 using value_type = typename inherited::value_type;
40
41 public:
42 /**
43 * \see docs on Set<> constructor
44 */
46 template <IEqualsComparer<T> EQUALS_COMPARER>
47 explicit Set_LinkedList (EQUALS_COMPARER&& equalsComparer);
48 Set_LinkedList (Set_LinkedList&&) noexcept = default;
49 Set_LinkedList (const Set_LinkedList&) noexcept = default;
50 Set_LinkedList (const initializer_list<value_type>& src);
51 template <IEqualsComparer<T> EQUALS_COMPARER>
52 Set_LinkedList (EQUALS_COMPARER&& equalsComparer, const initializer_list<value_type>& src);
53 template <IIterableOfTo<T> ITERABLE_OF_ADDABLE>
54 requires (not derived_from<remove_cvref_t<ITERABLE_OF_ADDABLE>, Set_LinkedList<T>>)
55 explicit Set_LinkedList (ITERABLE_OF_ADDABLE&& src)
56#if qCompilerAndStdLib_RequiresNotMatchInlineOutOfLineForTemplateClassBeingDefined_Buggy
58 {
59 this->AddAll (forward<ITERABLE_OF_ADDABLE> (src));
60 AssertRepValidType_ ();
61 }
62#endif
63 ;
64 template <IEqualsComparer<T> EQUALS_COMPARER, IIterableOfTo<T> ITERABLE_OF_ADDABLE>
65 Set_LinkedList (EQUALS_COMPARER&& equalsComparer, ITERABLE_OF_ADDABLE&& src);
66 template <IInputIterator<T> ITERATOR_OF_ADDABLE>
67 Set_LinkedList (ITERATOR_OF_ADDABLE&& start, ITERATOR_OF_ADDABLE&& end);
68 template <IEqualsComparer<T> EQUALS_COMPARER, IInputIterator<T> ITERATOR_OF_ADDABLE>
69 Set_LinkedList (EQUALS_COMPARER&& equalsComparer, ITERATOR_OF_ADDABLE&& start, ITERATOR_OF_ADDABLE&& end);
70
71 public:
72 /**
73 */
74 nonvirtual Set_LinkedList& operator= (Set_LinkedList&&) noexcept = default;
75 nonvirtual Set_LinkedList& operator= (const Set_LinkedList&) = default;
76
77 private:
78 using IImplRepBase_ = typename Set<T>::_IRep;
79 template <qCompilerAndStdLib_ConstraintDiffersInTemplateRedeclaration_BWA (IEqualsComparer<T>) EQUALS_COMPARER>
80 class Rep_;
81
82 private:
83 nonvirtual void AssertRepValidType_ () const;
84 };
85
86}
87
88/*
89 ********************************************************************************
90 ******************************* Implementation Details *************************
91 ********************************************************************************
92 */
93
94#include "Set_LinkedList.inl"
95
96#endif /*_Stroika_Foundation_Containers_Concrete_Set_LinkedList_h_ */
Set_LinkedList<T> is an LinkedList-based concrete implementation of the Set<T> container pattern.
Implementation detail for Set<T> implementors.
Definition Set.h:549
Set<T> is a container of T, where once an item is added, additionally adds () do nothing.
Definition Set.h:105
typename inherited::value_type value_type
Definition Set.h:122
Common::ComparisonRelationDeclaration< Common::ComparisonRelationType::eEquals, function< bool(T, T)> > ElementEqualityComparerType
Definition Set.h:137
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.