cuda::experimental::stf::each_in_tuple
#
-
template<typename Tuple, typename F>
constexpr void cuda::experimental::stf::each_in_tuple(
)# Iterates over the elements of a tuple, applying a function to each element.
This function traverses the elements of a tuple at compile time and applies the provided callable
f
to each element. If the callable can be invoked with both the element’s index and value (f(index, element)
), both are passed; otherwise, only the element is passed (f(element)
).The iteration is performed using compile-time unrolling, making this utility suitable for constexpr and template metaprogramming scenarios.
Note
The index is provided as a compile-time constant (such as a
std::integral_constant
).The function is
constexpr
and can be used in constant expressions.This utility requires an
unroll<N>(lambda)
facility for compile-time iteration.
- Template Parameters:
Tuple – The type of the tuple to iterate over. May be an lvalue or rvalue reference.
F – The type of the callable to apply. Must be invocable with either
(index, element)
or(element)
.
- Parameters:
t – [in] The tuple whose elements will be visited.
f – [in] The function or functor to apply to each element (and optionally its index).