Stroika Library 3.0d16
 
Loading...
Searching...
No Matches
SortedCollection_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 ******************** SortedCollection_Factory<T, COMPARER> *********************
11 ********************************************************************************
12 */
13 template <typename T, ITotallyOrderingComparer<T> COMPARER>
14 constexpr SortedCollection_Factory<T, COMPARER>::SortedCollection_Factory (const FactoryFunctionType& f)
15 : fFactory_{f}
16 {
17 }
18 template <typename T, ITotallyOrderingComparer<T> COMPARER>
23 template <typename T, ITotallyOrderingComparer<T> COMPARER>
24 constexpr SortedCollection_Factory<T, COMPARER>::SortedCollection_Factory ([[maybe_unused]] const Hints& hints)
25 : SortedCollection_Factory{[] () -> FactoryFunctionType {
26 return [] (const COMPARER& comparer) {
29 }
30 else {
31 return Concrete::SortedCollection_stdmultiset<T>{Common::InOrderComparerAdapter<T, COMPARER>{comparer}};
32 }
33 };
34 }()}
35 {
36 }
37 template <typename T, ITotallyOrderingComparer<T> COMPARER>
39 {
40 return AccessDefault_ ();
41 }
42 template <typename T, ITotallyOrderingComparer<T> COMPARER>
43 inline auto SortedCollection_Factory<T, COMPARER>::operator() (const COMPARER& comparer) const -> ConstructedType
44 {
45 return this->fFactory_ (comparer);
46 }
47 template <typename T, ITotallyOrderingComparer<T> COMPARER>
48 void SortedCollection_Factory<T, COMPARER>::Register (const optional<SortedCollection_Factory>& f)
49 {
50 AccessDefault_ () = f.has_value () ? *f : SortedCollection_Factory{Hints{}};
51 }
52 template <typename T, ITotallyOrderingComparer<T> COMPARER>
54 {
55 static SortedCollection_Factory sDefault_{Hints{}};
56 return sDefault_;
57 }
58
59}
SortedCollection_stdmultiset<T> is an stdmultiset-based concrete implementation of the SortedCollecti...
Singleton factory object - Used to create the default backend implementation of a SortedCollection<> ...
A SortedCollection is a Collection<T> which remains sorted (iteration produces items sorted) even as ...
Use this to wrap any basic comparer, and produce a Less comparer.
Definition Compare.h:386