Stroika Library 3.0d16
 
Loading...
Searching...
No Matches
Stack_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_Stack_LinkedList_h_
5#define _Stroika_Foundation_Containers_Concrete_Stack_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 * TODO:
17 * @todo Improve performance of CTOR's using reverse-iterator without copy - if constexpr check IT type
18 *
19 */
20
22
23 /**
24 * \brief Stack_LinkedList<T> is an LinkedList-based concrete implementation of the Stack<T> container pattern.
25 *
26 * \note Runtime performance/complexity:
27 * Very good low overhead implementation
28 *
29 * o push/pop and top () are all constant complexity
30 * o size () is O(N), but empty () is constant
31 * o Uses Memory::UseBlockAllocationIfAppropriate
32 *
33 * \note \em Thread-Safety <a href="Thread-Safety.md#C++-Standard-Thread-Safety">C++-Standard-Thread-Safety</a>
34 *
35 */
36 template <typename T>
37 class Stack_LinkedList : public Stack<T> {
38 private:
39 using inherited = Stack<T>;
40
41 public:
42 /**
43 */
44 using value_type = typename inherited::value_type;
45
46 public:
47 /**
48 */
50 Stack_LinkedList (Stack_LinkedList&&) noexcept = default;
51 Stack_LinkedList (const Stack_LinkedList&) noexcept = default;
52 template <IIterableOfTo<T> ITERABLE_OF_ADDABLE>
53 requires (not derived_from<remove_cvref_t<ITERABLE_OF_ADDABLE>, Stack_LinkedList<T>>)
54 explicit Stack_LinkedList (ITERABLE_OF_ADDABLE&& src)
55#if qCompilerAndStdLib_RequiresNotMatchInlineOutOfLineForTemplateClassBeingDefined_Buggy
56 : Stack_LinkedList{src.begin (), src.end ()} {}
57#endif
58 ;
59 template <IInputIterator<T> ITERATOR_OF_ADDABLE>
60 Stack_LinkedList (ITERATOR_OF_ADDABLE&& start, ITERATOR_OF_ADDABLE&& end);
61
62 public:
63 nonvirtual Stack_LinkedList& operator= (Stack_LinkedList&&) noexcept = default;
64 nonvirtual Stack_LinkedList& operator= (const Stack_LinkedList&) = default;
65
66 private:
67 class Rep_;
68
69 private:
70 nonvirtual void AssertRepValidType_ () const;
71 };
72
73}
74
75/*
76 ********************************************************************************
77 ******************************* Implementation Details *************************
78 ********************************************************************************
79 */
80
81#include "Stack_LinkedList.inl"
82
83#endif /*_Stroika_Foundation_Containers_Concrete_Stack_LinkedList_h_ */
Stack_LinkedList<T> is an LinkedList-based concrete implementation of the Stack<T> container pattern.
typename inherited::value_type value_type
Definition Stack.h:88
nonvirtual Iterator< T > begin() const
Support for ranged for, and STL syntax in general.
static constexpr default_sentinel_t end() noexcept
Support for ranged for, and STL syntax in general.