Is it possible to go from `std::array` to `parameter pack` or `variadic`?
Hi guys
Quick question that I hope you guys would know the answer to..
Is it possible to go from `std::array` to `parameter pack` or `variadic`?
More precisely, consider this scenario as an example of what I’m asking
Quick question that I hope you guys would know the answer to..
Is it possible to go from `std::array` to `parameter pack` or `variadic`?
More precisely, consider this scenario as an example of what I’m asking
template <typename T, N>
T builtT() {
std::array<complexclass, N> array;
// ... populate array with some awesome login ...
return {array...}; <-- This
}
No any search results
You already invited:
2 Answers
Eston
Upvotes from:
you just need to build an index sequence
it's the same as working with a tuple, basically
although tbh it's a bit rare to go from array to parameter pack
because all the types are the same. So you're going from something that's easy to work with but more constrained, to something less constrained and harder to work with.
plante
Upvotes from:
Seems like maybe it would be simpler to just give `T` a constructor taking an array?
if you control T
but, I don't have broader context obviously... so if you want to stick with how you're doing it, the code above should help