Stroika Library 3.0d18
 
Loading...
Searching...
No Matches
Queue_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 ******************************* Queue_Factory<T> *******************************
11 ********************************************************************************
12 */
13 template <typename T>
14 constexpr Queue_Factory<T>::Queue_Factory (const FactoryFunctionType& f)
15 : fFactory_{f}
16 {
17 }
18 template <typename T>
20 : Queue_Factory{AccessDefault_ ()}
21 {
22 }
23 template <typename T>
24 constexpr Queue_Factory<T>::Queue_Factory ([[maybe_unused]] const Hints& hints)
25 : Queue_Factory{[] () -> FactoryFunctionType {
26 // @todo could use array impl due to better locality
27 return [] () { return Concrete::Queue_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 Queue_Factory<T>::Register (const optional<Queue_Factory>& f)
43 {
44 AccessDefault_ () = f.has_value () ? *f : Queue_Factory{Hints{}};
45 }
46 template <typename T>
48 {
49 static Queue_Factory sDefault_{Hints{}};
50 return sDefault_;
51 }
52
53}
Queue_DoublyLinkedList<T> is an Array-based concrete implementation of the Queue<T> container pattern...
Singleton factory object - Used to create the default backend implementation of a Queue<> container; ...
A Queue is a first-in-first-out (FIFO) data structure, where elements are arranged in well-ordered fa...
Definition Queue.h:95