diff --git a/include/iris/alloy/detail/tuple_impl.hpp b/include/iris/alloy/detail/tuple_impl.hpp index 1624c89..f18b97c 100644 --- a/include/iris/alloy/detail/tuple_impl.hpp +++ b/include/iris/alloy/detail/tuple_impl.hpp @@ -83,7 +83,7 @@ class tuple_impl<> #define IRIS_ALLOY_DETAIL_FWD_INITS(n, data) \ IRIS_PP_COMMA_IF(n) \ IRIS_PP_CAT(IRIS_ALLOY_DETAIL_MEMBER_PREFIX, \ - n)(static_cast(IRIS_PP_CAT(IRIS_ALLOY_DETAIL_FUNCTION_PARAM_2, n))) + n)(static_cast(IRIS_PP_CAT(IRIS_ALLOY_DETAIL_FUNCTION_PARAM_2, n))) #define IRIS_ALLOY_DETAIL_INITS(n, other) \ IRIS_PP_COMMA_IF(n) \ @@ -116,7 +116,7 @@ class tuple_impl<> #define IRIS_ALLOY_DETAIL_ASSIGN_ASSIGN(n, data) \ IRIS_PP_CAT(IRIS_ALLOY_DETAIL_MEMBER_PREFIX, n) = \ - static_cast(IRIS_PP_CAT(IRIS_ALLOY_DETAIL_FUNCTION_PARAM_2, n)); + static_cast(IRIS_PP_CAT(IRIS_ALLOY_DETAIL_FUNCTION_PARAM_2, n)); #define IRIS_ALLOY_DETAIL_ASSIGN_GET(n, other) \ IRIS_PP_CAT(IRIS_ALLOY_DETAIL_MEMBER_PREFIX, n) = alloy::get(static_cast(other)); @@ -306,7 +306,7 @@ class tuple_impl(us)...); + rest.assign(static_cast(us)...); } template @@ -425,7 +425,7 @@ class tuple_impl constexpr tuple_impl& operator=(UTuple&& other) { - [&, this](std::index_sequence) { assign(alloy::get(static_cast(other))...); }(std::index_sequence_for{}); + [&, this](std::index_sequence) { assign(alloy::get(static_cast(other))...); }(std::index_sequence_for{}); return *this; } diff --git a/include/iris/alloy/tuple.hpp b/include/iris/alloy/tuple.hpp index aeb8490..55c60fd 100644 --- a/include/iris/alloy/tuple.hpp +++ b/include/iris/alloy/tuple.hpp @@ -80,7 +80,7 @@ class tuple : public detail::tuple_impl template constexpr explicit tuple(construct_t, std::index_sequence, UTuple&& other) noexcept(detail::tuple_traits::all_nothrow_gettable && detail::tuple_traits::all_nothrow_constructible) - : base_type(alloy::get(static_cast(other))...) + : base_type(alloy::get(static_cast(other))...) {} public: @@ -191,7 +191,7 @@ class tuple : public detail::tuple_impl #endif constexpr explicit(!detail::tuple_traits::all_convertible) tuple(UTuple&& other) noexcept(detail::tuple_traits::all_nothrow_gettable && detail::tuple_traits::all_nothrow_constructible) - : tuple(construct, std::make_index_sequence>>{}, static_cast(other)) + : tuple(construct, std::make_index_sequence>>{}, static_cast(other)) {} #if __cpp_lib_reference_from_temporary >= 202202L @@ -315,7 +315,7 @@ class tuple : public detail::tuple_impl constexpr tuple& operator=(UTuple&& other) noexcept(detail::tuple_traits::all_nothrow_assignable) { - base_type::operator=(static_cast(other)); + base_type::operator=(static_cast(other)); return *this; } diff --git a/include/iris/alloy/utility.hpp b/include/iris/alloy/utility.hpp index 8d4a284..d460ef5 100644 --- a/include/iris/alloy/utility.hpp +++ b/include/iris/alloy/utility.hpp @@ -271,6 +271,10 @@ struct tuple_assign_impl; template struct tuple_assign_impl> { + static constexpr bool assignable = std::conjunction_v< + std::is_assignable, tuple_get_t>... + >; + static constexpr bool nothrow = std::conjunction_v< std::conjunction, is_nothrow_gettable>..., std::is_nothrow_assignable, tuple_get_t>... @@ -345,9 +349,11 @@ template } template + requires + (tuple_size_v> == tuple_size_v>) && + detail::tuple_assign_impl::assignable constexpr void tuple_assign(From&& from, To&& to) noexcept(detail::tuple_assign_impl::nothrow) { - static_assert(tuple_size_v> == tuple_size_v>); detail::tuple_assign_impl::apply(std::forward(from), std::forward(to)); }