I have an input of arrays of different types (
thrust::tuple<int, T> makeBiggerTuple(T tuple, int* array, int size)
if (size > 1)
return makeBiggerTuple(thrust::make_tuple(*array, tuple), array++, size - 1);
return thrust::make_tuple(*array, tuple);
You want a
boost::variant, or a hand rolled equivalent.
Doing what you asked at compile time with
tuples results in exponential bloat and is rarely the right thing to do. While I could write code that takes arrays of up to size 10 with up to 10 elements and calls a function with a custom tuple, the resulting 10 billion generated functions would blow up your compiler: and unless you want every function in your binary to also be 10 billion times larger, we would have to type erase the result anyhow.
As a general rule, use dynamic structures for dynamic data: we have a dynamic length, so
vector, and the data is of run time typed from a finite set, so