diff --git a/include/utempl/utils.hpp b/include/utempl/utils.hpp index 56ae4fe..ba965ee 100644 --- a/include/utempl/utils.hpp +++ b/include/utempl/utils.hpp @@ -20,6 +20,10 @@ struct Wrapper { }; }; +template +inline constexpr Wrapper kWrapper; + + template consteval auto ParseNumber() -> T { T response{}; @@ -334,7 +338,7 @@ inline constexpr auto Map(Tuple&& tuple, F&& f, TypeList result = {}) { template inline constexpr auto Map(F&& f, TypeList result = {}) { - return [f = std::forward(f), result](Tuple&& tuple){ + return [f = std::forward(f), result](Tuple&& tuple) { if constexpr(!std::is_same_v) { return Map(std::forward(tuple), std::move(f), result); } else { @@ -343,15 +347,23 @@ inline constexpr auto Map(F&& f, TypeList result = {}) { }; }; +template +consteval auto PackConstexprWrapper() { + return [&](std::index_sequence) { + return MakeTuple(kWrapper(Tuple)>...); + }(std::make_index_sequence>()); +}; + + template inline constexpr auto Reverse(Tuple&& tuple) { - return [&](std::index_sequence) { + return [&](std::index_sequence) { return MakeTuple(Get - Is - 1>(std::forward(tuple))...); }(std::make_index_sequence>()); }; consteval auto Reverse() { - return [](Tuple&& tuple){ + return [](Tuple&& tuple) { return Reverse(std::forward(tuple)); }; };