Stroika Library 3.0d16
 
Loading...
Searching...
No Matches
SortedCollection_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_SortedCollection_LinkedList_h_
5#define _Stroika_Foundation_Containers_Concrete_SortedCollection_LinkedList_h_
6
7#include "Stroika/Foundation/StroikaPreComp.h"
8
10
11/**
12 * \file
13 *
14 * \note Code-Status: <a href="Code-Status.md#Beta">Beta</a>
15 *
16 */
17
19
20 /**
21 * \brief SortedCollection_LinkedList<T> is an LinkedList-based concrete implementation of the SortedCollection<T> container pattern.
22 *
23 * \note Runtime performance/complexity:
24 * SortedCollection_LinkedList<T> is a compact, and reasonable implementation of Collections, so long as the Collection remains quite small
25 * (empty or just a few entires).
26 *
27 * o size () is O(N), but empty () is constant
28 * o Uses Memory::UseBlockAllocationIfAppropriate
29 * o Additions and Removals are O(N)
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>
35 private:
37
38 public:
39 using value_type = typename inherited::value_type;
40 using ElementThreeWayComparerType = typename SortedCollection<T>::ElementThreeWayComparerType;
41
42 public:
43 /**
44 * \see docs on SortedCollection<> constructor
45 */
47 template <Common::IInOrderComparer<T> INORDER_COMPARER>
48 explicit SortedCollection_LinkedList (INORDER_COMPARER&& inorderComparer);
51 SortedCollection_LinkedList (const initializer_list<T>& src);
52 template <Common::IInOrderComparer<T> INORDER_COMPARER>
53 SortedCollection_LinkedList (INORDER_COMPARER&& inOrderComparer, const initializer_list<T>& src);
54 template <IIterableOfTo<T> ITERABLE_OF_ADDABLE>
55 requires (not derived_from<remove_cvref_t<ITERABLE_OF_ADDABLE>, SortedCollection_LinkedList<T>>)
56 explicit SortedCollection_LinkedList (ITERABLE_OF_ADDABLE&& src)
57#if qCompilerAndStdLib_RequiresNotMatchInlineOutOfLineForTemplateClassBeingDefined_Buggy
59 {
60 this->AddAll (forward<ITERABLE_OF_ADDABLE> (src));
61 AssertRepValidType_ ();
62 }
63#endif
64 ;
65 template <Common::IInOrderComparer<T> INORDER_COMPARER, IIterableOfTo<T> ITERABLE_OF_ADDABLE>
66 SortedCollection_LinkedList (INORDER_COMPARER&& inOrderComparer, ITERABLE_OF_ADDABLE&& src);
67 template <IInputIterator<T> ITERATOR_OF_ADDABLE>
68 SortedCollection_LinkedList (ITERATOR_OF_ADDABLE&& start, ITERATOR_OF_ADDABLE&& end);
69 template <Common::IInOrderComparer<T> INORDER_COMPARER, IInputIterator<T> ITERATOR_OF_ADDABLE>
70 SortedCollection_LinkedList (INORDER_COMPARER&& inOrderComparer, ITERATOR_OF_ADDABLE&& start, ITERATOR_OF_ADDABLE&& end);
71
72 public:
73 /**
74 */
75 nonvirtual SortedCollection_LinkedList& operator= (SortedCollection_LinkedList&&) noexcept = default;
76 nonvirtual SortedCollection_LinkedList& operator= (const SortedCollection_LinkedList&) = default;
77
78 private:
79 using IImplRepBase_ = typename SortedCollection<T>::_IRep;
80 template <qCompilerAndStdLib_ConstraintDiffersInTemplateRedeclaration_BWA (Common::IInOrderComparer<T>) INORDER_COMPARER>
81 class Rep_;
82
83 private:
84 nonvirtual void AssertRepValidType_ () const;
85 };
86
87}
88
89/*
90 ********************************************************************************
91 ******************************* Implementation Details *************************
92 ********************************************************************************
93 */
94#include "SortedCollection_LinkedList.inl"
95
96#endif /*_Stroika_Foundation_Containers_Concrete_SortedCollection_LinkedList_h_ */
nonvirtual void AddAll(ITERATOR_OF_ADDABLE &&start, ITERATOR_OF_ADDABLE2 &&end)
typename inherited::value_type value_type
Definition Collection.h:116
SortedCollection_LinkedList<T> is an LinkedList-based concrete implementation of the SortedCollection...
Implementation detail for SortedCollection<T> implementors.
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.