Stroika Library 3.0d16
 
Loading...
Searching...
No Matches
SortedSet_Factory.inl
1/*
2 * Copyright(c) Sophist Solutions, Inc. 1990-2025. All rights reserved
3 */
5
7 template <typename T>
8 class SortedSet_stdset; // avoid issue with #include deadly embrace
9}
10namespace Stroika::Foundation::Containers::Factory {
11
12 /*
13 ********************************************************************************
14 ************************** SortedSet_Factory<T, COMPARER> **********************
15 ********************************************************************************
16 */
17 template <typename T, ITotallyOrderingComparer<T> COMPARER>
18 constexpr SortedSet_Factory<T, COMPARER>::SortedSet_Factory (const FactoryFunctionType& f)
19 : fFactory_{f}
20 {
21 }
22 template <typename T, ITotallyOrderingComparer<T> COMPARER>
24 : SortedSet_Factory{AccessDefault_ ()}
25 {
26 }
27 template <typename T, ITotallyOrderingComparer<T> COMPARER>
28 constexpr SortedSet_Factory<T, COMPARER>::SortedSet_Factory ([[maybe_unused]] const Hints& hints)
29 : SortedSet_Factory{[] () -> FactoryFunctionType {
30 return [] (const COMPARER& comparer) {
32 return Concrete::SortedSet_stdset<T>{comparer};
33 }
34 else {
35 return Concrete::SortedSet_stdset<T>{Common::InOrderComparerAdapter<T, COMPARER>{comparer}};
36 }
37 };
38 }()}
39 {
40 }
41 template <typename T, ITotallyOrderingComparer<T> COMPARER>
43 {
44 return AccessDefault_ ();
45 }
46 template <typename T, ITotallyOrderingComparer<T> COMPARER>
47 inline auto SortedSet_Factory<T, COMPARER>::operator() (const COMPARER& comparer) const -> ConstructedType
48 {
49 return this->fFactory_ (comparer);
50 }
51 template <typename T, ITotallyOrderingComparer<T> COMPARER>
52 void SortedSet_Factory<T, COMPARER>::Register (const optional<SortedSet_Factory>& f)
53 {
54 AccessDefault_ () = f.has_value () ? *f : SortedSet_Factory{Hints{}};
55 }
56 template <typename T, ITotallyOrderingComparer<T> COMPARER>
58 {
59 static SortedSet_Factory sDefault_{Hints{}};
60 return sDefault_;
61 }
62
63}
SortedSet_stdset<T> is an std::set-based concrete implementation of the SortedSet<T> container patter...
Singleton factory object - Used to create the default backend implementation of a SortedSet<> contain...
Use this to wrap any basic comparer, and produce a Less comparer.
Definition Compare.h:386