From d122a22ef123e8d0e5ca05ff760645da71b248b0 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Thu, 27 Mar 2025 01:02:23 +0000 Subject: applyToOthersType allows passing any params in, not just a T --- lib/collection.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/collection.h b/lib/collection.h index b7d7d81..853b982 100644 --- a/lib/collection.h +++ b/lib/collection.h @@ -195,10 +195,10 @@ protected: obj); } - template + template requires(sizeof...(Others) == 0) void - applyToOthersType(const auto &, T *) + applyToOthersType(const auto &, Params...) { } @@ -208,15 +208,16 @@ protected: { } - template + template requires(sizeof...(Others) > 0) void - applyToOthersType(const auto & func, T * obj) + applyToOthersType(const auto & func, Params &&... params) { ( [&]() { if constexpr (std::is_convertible_v) { - std::invoke(func, std::get>(otherObjects), obj); + std::invoke( + func, std::get>(otherObjects), std::forward(params)...); } }(), ...); -- cgit v1.2.3