Stroika Library 3.0d18
 
Loading...
Searching...
No Matches
Collection_stdforward_list.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_Collection_stdforward_list_h_
5#define _Stroika_Foundation_Containers_Concrete_Collection_stdforward_list_h_
6
7#include "Stroika/Foundation/StroikaPreComp.h"
8
9#include <forward_list>
10
11#include "Stroika/Foundation/Containers/Collection.h"
12
13/**
14 * \file
15 *
16 * \note Code-Status: <a href="Code-Status.md#Beta">Beta</a>
17 *
18 */
19
21
22 /**
23 * \brief Collection_stdforward_list<T> is an std::forward_list (singly linked list)-based concrete implementation of the Collection<T> container pattern.
24 *
25 * \note Runtime performance/complexity:
26 * o size () is O(N), but empty () is O(1)
27 *
28 * \note \em Thread-Safety <a href="Thread-Safety.md#C++-Standard-Thread-Safety">C++-Standard-Thread-Safety</a>
29 */
30 template <typename T>
32 private:
34
35 public:
36 using value_type = typename inherited::value_type;
37
38 public:
39 /**
40 * \brief STDFORWARDLIST is std::forward_list<> that can be used inside Collection_stdforward_list
41 */
42 using STDFORWARDLIST = forward_list<value_type, Memory::BlockAllocatorOrStdAllocatorAsAppropriate<value_type, sizeof (value_type) <= 1024>>;
43
44 public:
45 /**
46 * \see docs on Collection<T> constructor
47 */
51 Collection_stdforward_list (const initializer_list<value_type>& src);
52 template <IIterableOfTo<T> ITERABLE_OF_ADDABLE>
53 requires (not derived_from<remove_cvref_t<ITERABLE_OF_ADDABLE>, Collection_stdforward_list<T>>)
54 Collection_stdforward_list (ITERABLE_OF_ADDABLE&& src)
55#if qCompilerAndStdLib_RequiresNotMatchInlineOutOfLineForTemplateClassBeingDefined_Buggy
57 {
58 this->AddAll (forward<ITERABLE_OF_ADDABLE> (src));
59 AssertRepValidType_ ();
60 }
61#endif
62 ;
63 template <IInputIterator<T> ITERATOR_OF_ADDABLE>
64 Collection_stdforward_list (ITERATOR_OF_ADDABLE&& start, ITERATOR_OF_ADDABLE&& end);
65
66 public:
67 nonvirtual Collection_stdforward_list& operator= (Collection_stdforward_list&&) noexcept = default;
68 nonvirtual Collection_stdforward_list& operator= (const Collection_stdforward_list&) = default;
69
70 private:
71 class Rep_;
72
73 private:
74 nonvirtual void AssertRepValidType_ () const;
75 };
76
77}
78
79/*
80 ********************************************************************************
81 ******************************* Implementation Details *************************
82 ********************************************************************************
83 */
84#include "Collection_stdforward_list.inl"
85
86#endif /*_Stroika_Foundation_Containers_Concrete_Collection_stdforward_list_h_ */
conditional_t< qStroika_Foundation_Memory_PreferBlockAllocation and andTrueCheck, BlockAllocator< T >, std::allocator< T > > BlockAllocatorOrStdAllocatorAsAppropriate
for type T, either use BlockAllocator<T>, or std::allocator
A Collection<T> is a container to manage an un-ordered collection of items, without equality defined ...
nonvirtual void AddAll(ITERATOR_OF_ADDABLE &&start, ITERATOR_OF_ADDABLE2 &&end)
Collection_stdforward_list<T> is an std::forward_list (singly linked list)-based concrete implementat...
forward_list< value_type, Memory::BlockAllocatorOrStdAllocatorAsAppropriate< value_type, sizeof(value_type)<=1024 > > STDFORWARDLIST
STDFORWARDLIST is std::forward_list<> that can be used inside Collection_stdforward_list.
static constexpr default_sentinel_t end() noexcept
Support for ranged for, and STL syntax in general.