From d291853174a5b9f5ff8b762f84b1211cbe1f5c94 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Mon, 8 Jul 2024 00:44:46 +0200 Subject: [PATCH] Invocation: add cross-builder to inject a specific (node) allocator ...using the same pattern here as was successful also for the underlying lib::SeveralBuilder; even if it may seem logically backwards, it just reads much better and is more understandable, and has the added benefit of providing a dedicated definition scope, which can be kept separate from the constructor definition of the actual builder {{{ prepareNode() .withAllocator() .addLead(predecessor) .build() }}} --- src/steam/engine/node-builder.hpp | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/src/steam/engine/node-builder.hpp b/src/steam/engine/node-builder.hpp index f589b6525..75007a2cb 100644 --- a/src/steam/engine/node-builder.hpp +++ b/src/steam/engine/node-builder.hpp @@ -91,7 +91,7 @@ namespace engine { using std::forward; /////////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1367 : Rebuild the Node Invocation - namespace { + namespace { // policy configuration template class ALO =std::void_t, typename...INIT> struct AlloPolicySelector @@ -123,7 +123,9 @@ namespace engine { template using DataBuilder = typename POL::template BuilderType; - } + + }//(End) internal policy configuration + template class PortBuilder; @@ -132,6 +134,13 @@ namespace engine { class NodeBuilder : util::MoveOnly { + template + static auto + setupBuilder (INIT&& ...alloInit) + { + return POL::template setupBuilder (forward (alloInit)...); + } + using PortData = DataBuilder; @@ -140,7 +149,7 @@ namespace engine { public: template NodeBuilder (INIT&& ...alloInit) - : ports_{POL::template setupBuilder (forward (alloInit)...)} + : ports_{setupBuilder (forward (alloInit)...)} { } NodeBuilder @@ -158,6 +167,16 @@ namespace engine { // return move(*this); } + + /** cross-builder function to specify usage of a dedicated *node allocator* */ + template class ALO =std::void_t, typename...INIT> + auto + withAllocator (INIT&& ...alloInit) + { + return NodeBuilder>{forward(alloInit)...}; + } + + /****************************************************//** * Terminal: complete the Connectivity defined thus far. */