From b0e51d868fc65e939268f8cde3991fbd2522181f Mon Sep 17 00:00:00 2001 From: sha512sum Date: Tue, 26 Mar 2024 09:12:44 +0000 Subject: [PATCH] Add Unpack --- include/utempl/utils.hpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/include/utempl/utils.hpp b/include/utempl/utils.hpp index a12a24d..d4e9c2a 100644 --- a/include/utempl/utils.hpp +++ b/include/utempl/utils.hpp @@ -175,6 +175,14 @@ inline constexpr auto Map(Tuple&& tuple, F&& f, TypeList result = {}) { }; +template +inline constexpr auto Unpack(Tuple&& tuple, F&& f) -> decltype(auto) { + return [&](std::index_sequence) -> decltype(auto) { + return f(Get(std::forward(tuple))...); + }(std::make_index_sequence>()); +}; + + template inline constexpr auto Reverse(Tuple&& tuple) { return [&](std::index_sequence) {