Stroika Library 3.0d16
 
Loading...
Searching...
No Matches
Deque_Factory.inl
1/*
2 * Copyright(c) Sophist Solutions, Inc. 1990-2025. All rights reserved
3 */
5
6namespace Stroika::Foundation::Containers::Factory {
7
8 /*
9 ********************************************************************************
10 ******************************* Deque_Factory<T> *******************************
11 ********************************************************************************
12 */
13 template <typename T>
14 constexpr Deque_Factory<T>::Deque_Factory (const FactoryFunctionType& f)
15 : fFactory_{f}
16 {
17 }
18 template <typename T>
20 : Deque_Factory{AccessDefault_ ()}
21 {
22 }
23 template <typename T>
24 constexpr Deque_Factory<T>::Deque_Factory ([[maybe_unused]] const Hints& hints)
25 : Deque_Factory{[] () -> FactoryFunctionType {
26 // @todo some alternatives
27 return [] () { return Concrete::Deque_DoublyLinkedList<T>{}; };
28 }()}
29 {
30 }
31 template <typename T>
33 {
34 return AccessDefault_ ();
35 }
36 template <typename T>
38 {
39 return this->fFactory_ ();
40 }
41 template <typename T>
42 void Deque_Factory<T>::Register (const optional<Deque_Factory>& f)
43 {
44 AccessDefault_ () = f.has_value () ? *f : Deque_Factory{Hints{}};
45 }
46 template <typename T>
48 {
49 static Deque_Factory sDefault_{Hints{}};
50 return sDefault_;
51 }
52
53}
Deque_DoublyLinkedList<T> is an Array-based concrete implementation of the Deque<T> container pattern...
Singleton factory object - Used to create the default backend implementation of a Deque<> container; ...