Re: Storing struct in a array

2018-01-10 Thread Vino via Digitalmars-d-learn
On Tuesday, 9 January 2018 at 19:05:48 UTC, thedeemon wrote: On Tuesday, 9 January 2018 at 18:09:58 UTC, Vino wrote: It is possible to store struct in a array ans use the same in csvReader Sure, you can just pass the type of your struct to csvReader: Array!T1 T1s; reader(fName, T1s); //

Re: Storing struct in a array

2018-01-09 Thread thedeemon via Digitalmars-d-learn
On Tuesday, 9 January 2018 at 18:09:58 UTC, Vino wrote: It is possible to store struct in a array ans use the same in csvReader Sure, you can just pass the type of your struct to csvReader: Array!T1 T1s; reader(fName, T1s); // pass the array Type as a function parameter First you write

Re: Storing struct in a array

2018-01-09 Thread Vino via Digitalmars-d-learn
On Tuesday, 9 January 2018 at 17:41:10 UTC, Vino wrote: On Tuesday, 9 January 2018 at 17:00:05 UTC, thedeemon wrote: On Tuesday, 9 January 2018 at 13:49:41 UTC, Vino wrote: Hi All, It is possible to store struct in a array ans use the same in csvReader Sure, you can just pass the type of

Re: Storing struct in a array

2018-01-09 Thread Vino via Digitalmars-d-learn
On Tuesday, 9 January 2018 at 17:00:05 UTC, thedeemon wrote: On Tuesday, 9 January 2018 at 13:49:41 UTC, Vino wrote: Hi All, It is possible to store struct in a array ans use the same in csvReader Sure, you can just pass the type of your struct to csvReader: struct Layout { string name;

Re: Storing struct in a array

2018-01-09 Thread thedeemon via Digitalmars-d-learn
On Tuesday, 9 January 2018 at 13:49:41 UTC, Vino wrote: Hi All, It is possible to store struct in a array ans use the same in csvReader Sure, you can just pass the type of your struct to csvReader: struct Layout { string name; int value; double other; } auto readArrayOfStructs(string

Re: Storing struct in a array

2018-01-09 Thread Vino via Digitalmars-d-learn
On Tuesday, 9 January 2018 at 13:49:41 UTC, Vino wrote: 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; }

Storing struct in a array

2018-01-09 Thread Vino via Digitalmars-d-learn
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 =