Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions include/iris/alloy/detail/tuple_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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_TEMPLATE_PARAM_2, n)>(IRIS_PP_CAT(IRIS_ALLOY_DETAIL_FUNCTION_PARAM_2, n)))
n)(static_cast<IRIS_PP_CAT(IRIS_ALLOY_DETAIL_TEMPLATE_PARAM_2, n)&&>(IRIS_PP_CAT(IRIS_ALLOY_DETAIL_FUNCTION_PARAM_2, n)))

#define IRIS_ALLOY_DETAIL_INITS(n, other) \
IRIS_PP_COMMA_IF(n) \
Expand Down Expand Up @@ -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_TEMPLATE_PARAM_2, n)>(IRIS_PP_CAT(IRIS_ALLOY_DETAIL_FUNCTION_PARAM_2, n));
static_cast<IRIS_PP_CAT(IRIS_ALLOY_DETAIL_TEMPLATE_PARAM_2, n)&&>(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<n>(static_cast<decltype(other)>(other));
Expand Down Expand Up @@ -306,7 +306,7 @@ class tuple_impl<IRIS_PP_REPEAT(IRIS_ALLOY_TUPLE_LIMIT, IRIS_ALLOY_DETAIL_ARGS,
constexpr void assign(IRIS_PP_REPEAT(IRIS_ALLOY_TUPLE_LIMIT, IRIS_ALLOY_DETAIL_FWD_PARAMS, ), Us&&... us)
{
IRIS_PP_REPEAT(IRIS_ALLOY_TUPLE_LIMIT, IRIS_ALLOY_DETAIL_ASSIGN_ASSIGN, )
rest.assign(static_cast<Us>(us)...);
rest.assign(static_cast<Us&&>(us)...);
}

template<IRIS_PP_REPEAT(IRIS_ALLOY_TUPLE_LIMIT, IRIS_ALLOY_DETAIL_TEMPLATE_PARAMS, IRIS_ALLOY_DETAIL_TEMPLATE_PARAM_2)>
Expand Down Expand Up @@ -425,7 +425,7 @@ class tuple_impl<IRIS_PP_REPEAT(IRIS_ALLOY_TUPLE_LIMIT, IRIS_ALLOY_DETAIL_ARGS,
template<class UTuple>
constexpr tuple_impl& operator=(UTuple&& other)
{
[&, this]<std::size_t... Is>(std::index_sequence<Is...>) { assign(alloy::get<Is>(static_cast<UTuple>(other))...); }(std::index_sequence_for<Ts...>{});
[&, this]<std::size_t... Is>(std::index_sequence<Is...>) { assign(alloy::get<Is>(static_cast<UTuple&&>(other))...); }(std::index_sequence_for<Ts...>{});
return *this;
}

Expand Down
6 changes: 3 additions & 3 deletions include/iris/alloy/tuple.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class tuple : public detail::tuple_impl<Ts...>
template<std::size_t... Is, class UTuple>
constexpr explicit tuple(construct_t, std::index_sequence<Is...>, UTuple&& other)
noexcept(detail::tuple_traits<UTuple, Ts...>::all_nothrow_gettable && detail::tuple_traits<UTuple, Ts...>::all_nothrow_constructible)
: base_type(alloy::get<Is>(static_cast<UTuple>(other))...)
: base_type(alloy::get<Is>(static_cast<UTuple&&>(other))...)
{}

public:
Expand Down Expand Up @@ -191,7 +191,7 @@ class tuple : public detail::tuple_impl<Ts...>
#endif
constexpr explicit(!detail::tuple_traits<UTuple, Ts...>::all_convertible) tuple(UTuple&& other)
noexcept(detail::tuple_traits<UTuple, Ts...>::all_nothrow_gettable && detail::tuple_traits<UTuple, Ts...>::all_nothrow_constructible)
: tuple(construct, std::make_index_sequence<tuple_size_v<std::remove_cvref_t<UTuple>>>{}, static_cast<UTuple>(other))
: tuple(construct, std::make_index_sequence<tuple_size_v<std::remove_cvref_t<UTuple>>>{}, static_cast<UTuple&&>(other))
{}

#if __cpp_lib_reference_from_temporary >= 202202L
Expand Down Expand Up @@ -315,7 +315,7 @@ class tuple : public detail::tuple_impl<Ts...>
constexpr tuple& operator=(UTuple&& other)
noexcept(detail::tuple_traits<UTuple, Ts...>::all_nothrow_assignable)
{
base_type::operator=(static_cast<UTuple>(other));
base_type::operator=(static_cast<UTuple&&>(other));
return *this;
}

Expand Down
8 changes: 7 additions & 1 deletion include/iris/alloy/utility.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,10 @@ struct tuple_assign_impl;
template<class From, class To, std::size_t... Is>
struct tuple_assign_impl<From, To, std::index_sequence<Is...>>
{
static constexpr bool assignable = std::conjunction_v<
std::is_assignable<tuple_get_t<Is, To>, tuple_get_t<Is, From>>...
>;

static constexpr bool nothrow = std::conjunction_v<
std::conjunction<is_nothrow_gettable<Is, From>, is_nothrow_gettable<Is, To>>...,
std::is_nothrow_assignable<tuple_get_t<Is, To>, tuple_get_t<Is, From>>...
Expand Down Expand Up @@ -345,9 +349,11 @@ template<std::size_t... Sizes, TupleLike Tuple>
}

template<TupleLike From, TupleLike To>
requires
(tuple_size_v<std::remove_cvref_t<From>> == tuple_size_v<std::remove_cvref_t<To>>) &&
detail::tuple_assign_impl<From, To>::assignable
constexpr void tuple_assign(From&& from, To&& to) noexcept(detail::tuple_assign_impl<From, To>::nothrow)
{
static_assert(tuple_size_v<std::remove_cvref_t<From>> == tuple_size_v<std::remove_cvref_t<To>>);
detail::tuple_assign_impl<From, To>::apply(std::forward<From>(from), std::forward<To>(to));
}

Expand Down
Loading