diff --git a/src/lib/allocation-cluster.hpp b/src/lib/allocation-cluster.hpp index b179e83d2..b0acaa182 100644 --- a/src/lib/allocation-cluster.hpp +++ b/src/lib/allocation-cluster.hpp @@ -317,13 +317,11 @@ namespace lib { //-----Policies-to-use-AllocationCluster------------------------ - namespace { + namespace allo { // Setup for custom allocator policies + // Forward declaration: configuration policy for lib::SeveralBuilder template class ALO> struct AllocationPolicy; - } - - namespace allo { // Setup for custom allocator policies template class ALO, typename...ARGS> struct SetupSeveral; diff --git a/src/lib/several-builder.hpp b/src/lib/several-builder.hpp index bf597f679..afef23059 100644 --- a/src/lib/several-builder.hpp +++ b/src/lib/several-builder.hpp @@ -124,8 +124,7 @@ namespace lib { using std::move; using std::byte; - namespace {// Allocation management policies - + namespace { /** number of storage slots to open initially; * starting with an over-allocation similar to `std::vector` */ @@ -173,7 +172,10 @@ namespace lib { { return positiveDiff (alignment, alignof(void*)); } - + }//(End)helpers + + + namespace allo {// Allocation management policies /** * Generic factory to manage objects within an ArrayBucket storage, @@ -355,7 +357,7 @@ namespace lib { template using HeapOwn = AllocationPolicy; - }//(End)implementation details + }//(End) namespace several @@ -381,28 +383,29 @@ namespace lib { * patterns, consistency checks may throw at runtime, * when attempting to add an unsuitable element. */ - template - ,class E =I ///< a subclass element element type (relevant when not trivially movable and destructible) - ,class POL =HeapOwn ///< Allocator policy + template + ,class E =I ///< a subclass element element type (relevant when not trivially movable and destructible) + ,template class POL =allo::HeapOwn ///< Allocator policy template (parametrised `POL`) > class SeveralBuilder : private Several , util::MoveOnly - , POL + , POL { using Coll = Several; + using Policy = POL; - using Bucket = ArrayBucket; + using Bucket = several::ArrayBucket; using Deleter = typename Bucket::Deleter; public: SeveralBuilder() = default; /** start Several build using a custom allocator */ - template>> + template>> SeveralBuilder (ARGS&& ...alloInit) : Several{} - , POL{forward (alloInit)...} + , Policy{forward (alloInit)...} { } @@ -549,7 +552,7 @@ namespace lib { adjustStorage (newCnt, max (elmSiz, Coll::spread())); ENSURE (Coll::data_); ensureDeleter(); - POL::template createAt (Coll::data_, newPos, forward (args)...); + Policy::template createAt (Coll::data_, newPos, forward (args)...); Coll::data_->cnt = newPos+1; } @@ -583,7 +586,7 @@ namespace lib { { if (not (Coll::empty() or Coll::hasReserve (requiredSiz, newElms) - or POL::canExpand (Coll::data_, requiredSiz*(Coll::size() + newElms)) + or Policy::canExpand (Coll::data_, requiredSiz*(Coll::size() + newElms)) or canDynGrow())) throw err::Invalid{_Fmt{"Several-container is unable to accommodate further element of type %s; " "storage reserve (%d bytes ≙ %d elms) exhausted and unable to move " @@ -607,7 +610,7 @@ namespace lib { size_t overhead = sizeof(Bucket) + alignRes(alignof(E)); size_t safetyLim = LUMIERA_MAX_ORDINAL_NUMBER * Coll::spread(); size_t expandAlloc = min (positiveDiff (min (safetyLim - ,POL::ALLOC_LIMIT) + ,Policy::ALLOC_LIMIT) ,overhead) ,max (2*buffSiz, cnt*spread)); // round down to an even number of elements @@ -618,7 +621,7 @@ namespace lib { "exceeds safety limit of %d bytes"} % safetyLim ,LERR_(SAFETY_LIMIT)}; // allocate new storage block... - Coll::data_ = POL::realloc (Coll::data_, newCnt,spread); + Coll::data_ = Policy::realloc (Coll::data_, newCnt,spread); } ENSURE (Coll::data_); if (canWildMove() and spread != Coll::spread()) @@ -629,11 +632,11 @@ namespace lib { fitStorage() { REQUIRE (not Coll::empty()); - if (not (POL::canExpand (Coll::data_, Coll::size()) + if (not (Policy::canExpand (Coll::data_, Coll::size()) or canDynGrow())) throw err::Invalid{"Unable to shrink storage for Several-collection, " "since at least one element can not be moved."}; - Coll::data_ = POL::realloc (Coll::data_, Coll::size(), Coll::spread()); + Coll::data_ = Policy::realloc (Coll::data_, Coll::size(), Coll::spread()); } /** move existing data to accommodate spread */ @@ -709,7 +712,7 @@ namespace lib { Deleter selectDestructor() { - typename POL::Fac& factory(*this); + typename Policy::Fac& factory(*this); if (is_Subclass() and has_virtual_destructor_v) { @@ -831,7 +834,7 @@ namespace lib { * @see lib::AllocationCluster (which provides a custom adaptation) * @see SeveralBuilder_test::check_CustomAllocator() */ - template + template class POL> template class ALO, typename...ARGS> inline auto SeveralBuilder::withAllocator (ARGS&& ...args) @@ -841,8 +844,7 @@ namespace lib { "prior to adding any elements to the container"}; using Setup = allo::SetupSeveral; - using PolicyForAllo = typename Setup::template Policy; - using BuilderWithAllo = SeveralBuilder; + using BuilderWithAllo = SeveralBuilder; return BuilderWithAllo(forward (args)...); } diff --git a/src/steam/engine/node-builder.hpp b/src/steam/engine/node-builder.hpp index 5f8cc322e..ea0791f55 100644 --- a/src/steam/engine/node-builder.hpp +++ b/src/steam/engine/node-builder.hpp @@ -118,7 +118,7 @@ namespace engine { using PolicyForAllo = typename Setup::template Policy; template - using BuilderType = lib::SeveralBuilder>; + using BuilderType = lib::SeveralBuilder; }; struct UseHeapAlloc diff --git a/wiki/thinkPad.ichthyo.mm b/wiki/thinkPad.ichthyo.mm index 31a8d8cc5..a4d0f64e0 100644 --- a/wiki/thinkPad.ichthyo.mm +++ b/wiki/thinkPad.ichthyo.mm @@ -2805,9 +2805,7 @@ - - - +

GTK bietet nur Anzeigen von top-down: @@ -3123,9 +3121,7 @@ - - - +

...weil der Payload-Typ für diesen Aufruf bool ist, @@ -3142,9 +3138,7 @@ - - - +

k @@ -5000,9 +4994,7 @@ - - - +

Architektur-Entscheidung @@ -7319,9 +7311,7 @@ - - - +

navigate to the real UI component @@ -10760,9 +10750,7 @@ - - - +

verschiedendste Pipeline-Konstruktionen @@ -87719,8 +87707,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
Alle Typen sind bekannt und bereits angeschrieben; die neulich gefundene Lösung mit dem decltype(<builder>)-Trick hat mich zwar zum Ziel gebracht, ist aber unnötig indirekt — man könnte durchaus die Typen ineinander einsetzen und dann in eine einzige Typedef reduzieren

- -
+ @@ -87733,8 +87720,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
Namens-Idee: AlloPolicySelector

- - + @@ -87758,6 +87744,24 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
+ + + + + + + + + + +

+ es bieteten sich an: lib::several und lib::allo ⟵ letzteres ist logischer! +

+ + +
+
+