how to access record[0] of a csv row? Error: no [] operator overload for type CsvRecord!(int, cast(Malformed)1, string, dchar)

mw mingwu at gmail.com
Mon Dec 7 06:18:33 UTC 2020


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];)


More information about the Digitalmars-d-learn mailing list