diff --git a/include/utempl/utils.hpp b/include/utempl/utils.hpp index cdad54b..f6d1261 100644 --- a/include/utempl/utils.hpp +++ b/include/utempl/utils.hpp @@ -162,13 +162,19 @@ template concept TupleLike = kForceEnableTuple> || (requires{Get<0>(MakeTuple(42));} && impl::IsSafeTuple>::value); -template -inline constexpr auto Transform(Tuple&& container, auto&& f, TypeList = {}) { +template +inline constexpr auto Transform(Tuple&& container, F&& f, TypeList = {}) { return [&](std::index_sequence){ return MakeTuple(f(Get(std::forward(container)))...); }(std::make_index_sequence>()); }; +template +inline constexpr auto Map(Tuple&& tuple, F&& f, TypeList result = {}) { + return Transform(std::forward(tuple), std::forward(f), result); +}; + + template inline constexpr auto Reverse(Tuple&& tuple) { return [&](std::index_sequence) {