cuda::experimental::stf::tuple_transform
Defined in include/cuda/experimental/__stf/utility/core.cuh
-
template<typename Tuple, typename F>
constexpr auto cuda::experimental::stf::tuple_transform(Tuple &&t, F &&f) Applies a transformation to each element of a tuple, optionally passing the index.
Iterates over the elements of a tuple and applies the provided functor
f
to each element. Iff
is invocable with both the index and the element (f(index, element)
), that form is used. Otherwise, it falls back tof(element)
. The index is a compile-time constant of typestd::integral_constant<std::size_t, i>
, wherei
is the index of the element in the tuple.- Template Parameters
Tuple – The type of the input tuple.
F – The type of the transformation functor.
- Parameters
t – The input tuple to transform.
f – The transformation functor. Must be invocable with either
f(element)
orf(index, element)
.
- Returns
A new tuple containing the results of applying
f
to each element oft
.