Storing struct in a array
    thedeemon 
    dlang at thedeemon.com
       
    Tue Jan  9 17:00:05 UTC 2018
    
    
  
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 fname) {
     Array!Layout res;
     foreach(record; fname.readText.csvReader!Layout('\t')) {
         res ~= record;
     }
     return res;
}
    
    
More information about the Digitalmars-d-learn
mailing list