diff --git a/include/utempl/tuple.hpp b/include/utempl/tuple.hpp index 5a2d468..524e764 100644 --- a/include/utempl/tuple.hpp +++ b/include/utempl/tuple.hpp @@ -17,20 +17,15 @@ struct TupleLeaf { inline constexpr bool operator==(const TupleLeaf&) const = default; }; -template -struct TupleHelper { - consteval TupleHelper() = default; - inline constexpr TupleHelper(const TupleHelper&) = default; - inline constexpr TupleHelper(TupleHelper&&) = default; - inline constexpr bool operator==(const TupleHelper&) const = default; -}; -template -struct TupleHelper : public TupleLeaf , public TupleHelper { - template - inline constexpr TupleHelper(TT&& arg, TTs&&... args) : - TupleLeaf{std::forward(arg)}, - TupleHelper{std::forward(args)...} {}; +template +struct TupleHelper; + +template +struct TupleHelper, Ts...> : public TupleLeaf... { + template + inline constexpr TupleHelper(TTs&&... args) : + TupleLeaf{std::forward(args)}... {}; inline constexpr TupleHelper(const TupleHelper&) = default; inline constexpr TupleHelper(TupleHelper&&) = default; inline constexpr bool operator==(const TupleHelper&) const = default; @@ -65,10 +60,10 @@ inline constexpr auto Get(T&& arg) -> decltype(get(std::forward(arg))) { }; template -struct Tuple : public impl::TupleHelper<0, Ts...> { +struct Tuple : public impl::TupleHelper, Ts...> { template inline constexpr Tuple(TTs&&... args) : - impl::TupleHelper<0, Ts...>(std::forward(args)...) {}; + impl::TupleHelper, Ts...>(std::forward(args)...) {}; inline constexpr Tuple(const Tuple&) = default; inline constexpr Tuple(Tuple&&) = default; inline constexpr bool operator==(const Tuple&) const = default;