On Monday, 11 January 2016 at 12:15:55 UTC, Saurabh Das wrote:

Any ideas?

Yes. Because Typedef is introducing new Types, which csvReader doesn't know what they are,
you'll need a little workaround and cast the values yourself.

import std.csv, std.stdio, std.algorithm, std.range;

enum csvTxt = "10, 20
30, 40
50, 50";

myStuff = csvTxt.csvReader!(Tuple!(long, long))
        .map!(a => MyStuff(cast(QuestionId)a[0], cast(StudentId) a[1]))
        .array;


The .map does nothing other as getting the information out of the Tuple 'a' and constructing a struct of the type MyStuff.

togrue

Reply via email to