Storing struct in a array

Vino vino.bheeman at hotmail.com
Tue Jan 9 13:49:41 UTC 2018


Hi All,

  It is possible to store struct in a array ans use the same in 
csvReader e.g.

import std.stdio;
import std.container.array;

void main () {
Array!string a;
struct Layout { string name; int value; double other; }

a.insert(Layout);
auto record =  
uFile.byLineCopy().joiner("\n").csvReader!(Tuple!a[0]))
foreach (record; records)
{
     writeln(record.name);
     writeln(record.value);
     writeln(record.other);
}

From,
Vino.B


More information about the Digitalmars-d-learn mailing list