If I have std::tuple (where the type is homogeneous), is there a stock function or constructor to convert to std::array
I would return the array instead of populating it by reference, so that auto can be used to make the callsite cleaner:
template
std::array
fill_array_from_tuple(const std::tuple& t) {
std::array arr;
ArrayFiller::fill_array_from_tuple(t, arr);
return arr;
}
// ...
std::tuple tup(0.1, 0.2, 0.3);
auto arr = fill_array_from_tuple(tup);
Realistically, NRVO will eliminate most performance concerns.