Stroika Library 3.0d16
 
Loading...
Searching...
No Matches
KeyedCollection_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_KeyedCollection_LinkedList_h_
5#define _Stroika_Foundation_Containers_Concrete_KeyedCollection_LinkedList_h_
6
7#include "Stroika/Foundation/StroikaPreComp.h"
8
9#include "Stroika/Foundation/Containers/KeyedCollection.h"
10
11/**
12 * \file
13 *
14 * \note Code-Status: <a href="Code-Status.md#Beta">Beta</a>
15 *
16 */
17
19
20 template <typename T, typename KEY_TYPE, typename TRAITS>
21 class KeyedCollection;
22
23}
24
26
27 /**
28 * \brief KeyedCollection_LinkedList<T> is an LinkedList-based concrete implementation of the KeyedCollection<T> container pattern.
29 *
30 * \note Runtime performance/complexity:
31 * o size () is O(N), but empty () is constant
32 *
33 * \note \em Thread-Safety <a href="Thread-Safety.md#C++-Standard-Thread-Safety">C++-Standard-Thread-Safety</a>
34 */
35 template <typename T, typename KEY_TYPE, typename TRAITS = KeyedCollection_DefaultTraits<T, KEY_TYPE>>
36 class KeyedCollection_LinkedList : public KeyedCollection<T, KEY_TYPE, TRAITS> {
37 private:
39
40 public:
41 using TraitsType = typename inherited::TraitsType;
42 using KeyExtractorType = typename inherited::KeyExtractorType;
43 using KeyEqualityComparerType = typename inherited::KeyEqualityComparerType;
44 using KeyType = typename inherited::KeyType;
45 using value_type = typename inherited::value_type;
46
47 public:
48 /**
49 * \see docs on KeyedCollection<> constructor
50 */
51 template <IEqualsComparer<KEY_TYPE> KEY_EQUALS_COMPARER = equal_to<KEY_TYPE>>
52 KeyedCollection_LinkedList (KEY_EQUALS_COMPARER&& keyComparer = KEY_EQUALS_COMPARER{})
56 template <IEqualsComparer<KEY_TYPE> KEY_EQUALS_COMPARER = equal_to<KEY_TYPE>>
57 KeyedCollection_LinkedList (const KeyExtractorType& keyExtractor, KEY_EQUALS_COMPARER&& keyComparer = KEY_EQUALS_COMPARER{});
58 template <IIterableOfTo<T> ITERABLE_OF_ADDABLE>
60 not derived_from<remove_cvref_t<ITERABLE_OF_ADDABLE>, KeyedCollection_LinkedList<T, KEY_TYPE, TRAITS>>)
61 KeyedCollection_LinkedList (ITERABLE_OF_ADDABLE&& src)
62#if qCompilerAndStdLib_RequiresNotMatchInlineOutOfLineForTemplateClassBeingDefined_Buggy
63 : KeyedCollection_LinkedList{KeyExtractorType{}, equal_to<KEY_TYPE>{}}
64 {
65 this->AddAll (src);
66 AssertRepValidType_ ();
67 }
68#endif
69 ;
70 template <IIterableOfTo<T> ITERABLE_OF_ADDABLE, IEqualsComparer<KEY_TYPE> KEY_EQUALS_COMPARER = equal_to<KEY_TYPE>>
71 KeyedCollection_LinkedList (KEY_EQUALS_COMPARER&& keyComparer, ITERABLE_OF_ADDABLE&& src)
73 template <IEqualsComparer<KEY_TYPE> KEY_EQUALS_COMPARER, IIterableOfTo<T> ITERABLE_OF_ADDABLE>
74 KeyedCollection_LinkedList (const KeyExtractorType& keyExtractor, KEY_EQUALS_COMPARER&& keyComparer, ITERABLE_OF_ADDABLE&& src);
75 template <IInputIterator<T> ITERATOR_OF_ADDABLE, IEqualsComparer<KEY_TYPE> KEY_EQUALS_COMPARER = equal_to<KEY_TYPE>>
76 KeyedCollection_LinkedList (ITERATOR_OF_ADDABLE&& start, ITERATOR_OF_ADDABLE&& end)
78 template <IInputIterator<T> ITERATOR_OF_ADDABLE, IEqualsComparer<KEY_TYPE> KEY_EQUALS_COMPARER = equal_to<KEY_TYPE>>
79 KeyedCollection_LinkedList (KEY_EQUALS_COMPARER&& keyComparer, ITERATOR_OF_ADDABLE&& start, ITERATOR_OF_ADDABLE&& end)
81 template <IEqualsComparer<KEY_TYPE> KEY_EQUALS_COMPARER, IInputIterator<T> ITERATOR_OF_ADDABLE>
82 KeyedCollection_LinkedList (const KeyExtractorType& keyExtractor, KEY_EQUALS_COMPARER&& keyComparer, ITERATOR_OF_ADDABLE&& start,
83 ITERATOR_OF_ADDABLE&& end);
84
85 public:
86 nonvirtual KeyedCollection_LinkedList& operator= (KeyedCollection_LinkedList&&) noexcept = default;
87 nonvirtual KeyedCollection_LinkedList& operator= (const KeyedCollection_LinkedList&) = default;
88
89 private:
90 using IImplRep_ = typename KeyedCollection<T, KEY_TYPE, TRAITS>::_IRep;
91 template <qCompilerAndStdLib_ConstraintDiffersInTemplateRedeclaration_BWA (IEqualsComparer<KEY_TYPE>) KEY_EQUALS_COMPARER>
92 class Rep_;
93
94 private:
95 nonvirtual void AssertRepValidType_ () const;
96 };
97
98}
99
100/*
101 ********************************************************************************
102 ******************************* Implementation Details *************************
103 ********************************************************************************
104 */
105#include "KeyedCollection_LinkedList.inl"
106
107#endif /*_Stroika_Foundation_Containers_Concrete_KeyedCollection_LinkedList_h_ */
KeyedCollection_LinkedList<T> is an LinkedList-based concrete implementation of the KeyedCollection<T...
Implementation detail for KeyedCollection<KEY_TYPE, T, TRAITS> implementors.
a cross between Mapping<KEY, T> and Collection<T> and Set<T>
typename TRAITS::KeyExtractorType KeyExtractorType
nonvirtual unsigned int AddAll(ITERATOR_OF_ADDABLE &&start, ITERATOR_OF_ADDABLE2 &&end)
Common::ComparisonRelationDeclaration< Common::ComparisonRelationType::eEquals, function< bool(ArgByValueType< KEY_TYPE >, ArgByValueType< KEY_TYPE >)> > KeyEqualityComparerType
static constexpr default_sentinel_t end() noexcept
Support for ranged for, and STL syntax in general.