diff --git a/include/utempl/tuple.hpp b/include/utempl/tuple.hpp index 0087d25..7bd12c5 100644 --- a/include/utempl/tuple.hpp +++ b/include/utempl/tuple.hpp @@ -1,6 +1,6 @@ #pragma once #include - +#include namespace utempl { template @@ -10,10 +10,6 @@ namespace impl { template struct TupleLeaf { T value; - template - inline constexpr TupleLeaf(TT&& arg) : value(std::forward(arg)) {}; - inline constexpr TupleLeaf(const TupleLeaf&) = default; - inline constexpr TupleLeaf(TupleLeaf&&) = default; inline constexpr bool operator==(const TupleLeaf&) const = default; }; @@ -64,6 +60,8 @@ struct Tuple : public impl::TupleHelper, Ts...> { template inline constexpr Tuple(TTs&&... args) : impl::TupleHelper, Ts...>(std::forward(args)...) {}; + inline constexpr Tuple(Ts... args) : + impl::TupleHelper, Ts...>(std::move(args)...) {}; inline constexpr Tuple(const Tuple&) = default; inline constexpr Tuple(Tuple&&) = default; inline constexpr bool operator==(const Tuple&) const = default; @@ -82,14 +80,24 @@ struct Tuple : public impl::TupleHelper, Ts...> { return Get(*this); }; }; +namespace impl { + +template +struct Process { + using type = decltype(Overloaded( + [](TT&&) -> std::remove_cvref_t {}, + [](const char(&)[N]) -> const char(&)[N] {} + )(std::declval())); +}; + +} // namespace impl template -Tuple(Ts&&...) -> Tuple...>; +Tuple(Ts&&...) -> Tuple::type...>; template consteval auto ListFromTuple(Tuple) -> TypeList { return {}; }; - } // namespace utempl