From 107d03f6ef1bb6ffecca528b02985a1aa41cd719 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Sun, 29 Dec 2024 23:55:19 +0100 Subject: [PATCH] Invocation: invoke the param-functors and build extension block Relying basically on the trick to invoke std::apply with a generic variadic Lambda onto the tuple of functors; within the lambda we can use variadic expansion to pass the results directly into the builder and so construct the param-tuple in-place. Oh well. 2024 is almost gone by now. Had to endure yet another performance of Beethoven's 9th symphony... --- src/steam/engine/param-weaving-pattern.hpp | 8 ++++--- tests/core/steam/engine/node-feed-test.cpp | 3 +++ wiki/thinkPad.ichthyo.mm | 26 ++++++++++++++++++---- 3 files changed, 30 insertions(+), 7 deletions(-) diff --git a/src/steam/engine/param-weaving-pattern.hpp b/src/steam/engine/param-weaving-pattern.hpp index a4d97b00f..5341d37e8 100644 --- a/src/steam/engine/param-weaving-pattern.hpp +++ b/src/steam/engine/param-weaving-pattern.hpp @@ -113,9 +113,11 @@ namespace engine { typename ChainCons::NewFrame buildParamDataBlock (TurnoutSystem& turnoutSys) { - auto invoke = [&](auto& fun) { return fun(turnoutSys); }; - ParamTup params = lib::meta::mapEach(functors_, invoke); - //////////////////////////////////////////////////////////////OOO now need to extract them + return std::apply ([&](auto&&... paramFun) + { // invoke parameter-functors and build NewFrame from results + return ChainCons::build (paramFun (turnoutSys) ...); + } + ,functors_); } diff --git a/tests/core/steam/engine/node-feed-test.cpp b/tests/core/steam/engine/node-feed-test.cpp index 6ef694440..0c964c1f2 100644 --- a/tests/core/steam/engine/node-feed-test.cpp +++ b/tests/core/steam/engine/node-feed-test.cpp @@ -131,6 +131,9 @@ SHOW_EXPR(v0) SHOW_EXPR(v1) auto paramBlock = spec.buildParamDataBlock (turnoutSys); +SHOW_EXPR(paramBlock) +SHOW_EXPR(paramBlock.get<0>()) +SHOW_EXPR(paramBlock.get<1>()) TODO ("implement a simple Builder for ParamAgent-Node"); TODO ("then use both together to demonstrate a param data feed here"); diff --git a/wiki/thinkPad.ichthyo.mm b/wiki/thinkPad.ichthyo.mm index b5a9ba876..bc9c9745a 100644 --- a/wiki/thinkPad.ichthyo.mm +++ b/wiki/thinkPad.ichthyo.mm @@ -94325,13 +94325,31 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- - - + + + + + + - + + + + + + +

+ also den gleichen Kniff, auf dem auch lib::meta::forEach und lib::meta::mapEach beruhen: man wendet per std::apply ein generisches variadisches Lambda auf die Tupel-Elemente an +

+ +
+
+ + + +