Stroika Library 3.0d16
 
Loading...
Searching...
No Matches
Sequence_Array.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_Sequence_Array_h_
5#define _Stroika_Foundation_Containers_Concrete_Sequence_Array_h_
6
7#include "Stroika/Foundation/StroikaPreComp.h"
8
10#include "Stroika/Foundation/Containers/Sequence.h"
11
12/**
13 * \file
14 *
15 * \note Code-Status: <a href="Code-Status.md#Beta">Beta</a>
16 *
17 */
18
20
21 /**
22 * \brief Sequence_Array<T> is an Array-based concrete implementation of the Sequence<T> container pattern.
23 *
24 * \note Runtime performance/complexity:
25 * o push_back should perform well (typically constant time, but occasionally O(N))
26 * o it is FAST to array index a Sequence_Array.
27 * o size () is constant complexity
28 *
29 * \note \em Thread-Safety <a href="Thread-Safety.md#C++-Standard-Thread-Safety">C++-Standard-Thread-Safety</a>
30 */
31 template <typename T>
32 class Sequence_Array : public Private::ArrayBasedContainer<Sequence_Array<T>, Sequence<T>, false> {
33 private:
35
36 public:
37 using value_type = typename inherited::value_type;
38
39 public:
40 /**
41 * \see docs on Sequence<> constructor
42 */
44 Sequence_Array (Sequence_Array&&) noexcept = default;
45 Sequence_Array (const Sequence_Array&) noexcept = default;
46 Sequence_Array (const initializer_list<value_type>& src);
47 template <IIterableOfTo<T> ITERABLE_OF_ADDABLE>
48 requires (not derived_from<remove_cvref_t<ITERABLE_OF_ADDABLE>, Sequence_Array<T>>)
49 explicit Sequence_Array (ITERABLE_OF_ADDABLE&& src)
50#if qCompilerAndStdLib_RequiresNotMatchInlineOutOfLineForTemplateClassBeingDefined_Buggy
52 {
54 this->reserve (src.size ());
55 }
56 this->AppendAll (forward<ITERABLE_OF_ADDABLE> (src));
57 AssertRepValidType_ ();
58 }
59#endif
60 ;
61 template <IInputIterator<T> ITERATOR_OF_ADDABLE>
62 Sequence_Array (ITERATOR_OF_ADDABLE&& start, ITERATOR_OF_ADDABLE&& end);
63
64 public:
65 /**
66 */
67 nonvirtual Sequence_Array& operator= (Sequence_Array&&) noexcept = default;
68 nonvirtual Sequence_Array& operator= (const Sequence_Array&) = default;
69
70 private:
71 class Rep_;
72
73 private:
74 nonvirtual void AssertRepValidType_ () const;
75
76 private:
78 };
79
80}
81
82/*
83 ********************************************************************************
84 ******************************* Implementation Details *************************
85 ********************************************************************************
86 */
87
88#include "Sequence_Array.inl"
89
90#endif /*_Stroika_Foundation_Containers_Concrete_Sequence_Array_h_ */
Sequence_Array<T> is an Array-based concrete implementation of the Sequence<T> container pattern.
ArrayBasedContainer is a Stroika implementation detail, but its public methods are fair game and full...
A generalization of a vector: a container whose elements are keyed by the natural numbers.
Definition Sequence.h:187
typename inherited::value_type value_type
Definition Sequence.h:198
nonvirtual void AppendAll(ITERABLE_OF_ADDABLE &&s)
static constexpr default_sentinel_t end() noexcept
Support for ranged for, and STL syntax in general.
Concept checks if the given type T has a const size() method which can be called to return a size_t.
Definition Concepts.h:361