From c6511790db2276301d1c465a390efe4e957a8dcb Mon Sep 17 00:00:00 2001 From: sha512sum Date: Wed, 28 Feb 2024 21:41:01 +0000 Subject: [PATCH] Tuple changes --- include/utempl/tuple.hpp | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) 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