diff --git a/include/utempl/tuple.hpp b/include/utempl/tuple.hpp index 7bd12c5..9fa94b5 100644 --- a/include/utempl/tuple.hpp +++ b/include/utempl/tuple.hpp @@ -64,17 +64,27 @@ struct Tuple : public impl::TupleHelper, Ts...> { 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; + + template + inline constexpr bool operator==(const Tuple& other) const + requires (TypeList{} == TypeList{}) { + return [&](std::index_sequence){ + return ((Get(*this) == Get(other)) && ...); + }(std::index_sequence_for()); + }; + template inline constexpr auto operator+(const Tuple& other) const -> Tuple { return [&](std::index_sequence, std::index_sequence) -> Tuple { return {Get(*this)..., Get(other)...}; }(std::index_sequence_for(), std::index_sequence_for()); }; + template inline constexpr auto operator[](Wrapper) const -> const auto& { return Get(*this); }; + template inline constexpr auto operator[](Wrapper) -> auto& { return Get(*this); @@ -86,7 +96,7 @@ template struct Process { using type = decltype(Overloaded( [](TT&&) -> std::remove_cvref_t {}, - [](const char(&)[N]) -> const char(&)[N] {} + [](const char(&)[N]) -> const char* {} )(std::declval())); }; diff --git a/include/utempl/utils.hpp b/include/utempl/utils.hpp index 9bbaba8..b421b37 100644 --- a/include/utempl/utils.hpp +++ b/include/utempl/utils.hpp @@ -66,10 +66,7 @@ template inline constexpr std::size_t kTupleSize = kTupleSize>; template -inline constexpr std::size_t kTupleSize = kTupleSize>; - -template -inline constexpr std::size_t kTupleSize = kTupleSize>; +inline constexpr std::size_t kTupleSize = kTupleSize>; template