7 template<
size_t N,
typename Src,
typename Destination,
typename Func>
8 [[maybe_unused]]constexpr
void tuple_call_assign(Src
const& source, Destination& destination, Func f) {
9 std::get<N>(destination) = f(std::get<N>(source));
12 template<
typename Src,
typename Destination,
typename Func,
size_t... Is>
13 [[maybe_unused]]constexpr
void tuple_transform_index(Src
const& source, Destination& destination, Func f, std::index_sequence<Is...>) {
14 using expander =
int[];
15 (void) expander{0, (tuple_call_assign<Is>(source, destination, f), 0)...};
27 template<
typename... Src,
typename... Destination,
typename Func>
28 constexpr
void tuple_transform(std::tuple<Destination...>& destination, Func f, std::tuple<Src...>
const& source) {
29 static_assert(
sizeof...(Src) ==
sizeof...(Destination),
"Tuples must have the same length");
30 tuple_transform_index<>(source, destination, f, std::index_sequence_for<Src...>());