cuda::experimental::stf::shuffled_array_tuple
Defined in include/cuda/experimental/__stf/utility/traits.cuh
-
template<typename ...DataTypes, typename ...ArgTypes>
auto cuda::experimental::stf::shuffled_array_tuple(ArgTypes... args) Creates a tuple where each element is an
std::array
, constructed from the arguments provided.This function constructs a tuple where each element is an array of a specific type. Each array in the tuple contains all the arguments of the corresponding type. The function checks at compile-time to ensure that each argument type is convertible to exactly one of the tuple’s element types, avoiding ambiguity or incompatible types.
Example usage:
auto result = shuffled_array_tuple<int, double, char>('a', 5, 6.0, 'b', 7); // result is a tuple containing: // std::array<int, 2> {5, 7}, // std::array<double, 1> {6.0}, // std::array<char, 2> {'a', 'b'}
Note
The function uses
all_convertible
internally to construct arrays for each data type inDataTypes
.- Template Parameters
DataTypes – The types of the arrays in the tuple. Each type corresponds to an array in the tuple.
ArgTypes – Variadic template representing the types of the arguments.
- Parameters
args – The arguments from which the arrays in the tuple are constructed. These can be in any order.
- Returns
A tuple where each element is an array of one of the
DataTypes
, containing the respective convertible arguments.