On Monday, 7 December 2020 at 04:38:07 UTC, Paul Backus wrote:
On Monday, 7 December 2020 at 04:03:05 UTC, mw wrote:
So my next question: given N, how do I create a Tuple!(double,
double, ... n-double) type programmatically?
import std.meta: Repeat;
alias NDoubles = Tuple!(Repeat!(N, double));
Note that N must be a compile-time constant, since the number
of elements in a Tuple is fixed at compile time.
Yes, I just realized that Tuple (upper T, compile time) and tuple
(lower t) are different things.
Now, how to convert it to a native array:
double[] row = record;
Error: cannot implicitly convert expression record of type
Tuple!(double, double, double, ..., double) to double[]
(I know for tuple, we can do: double[] arr = [record];)