Switch between two structs with csvreader

Selim Ozel sozel at wpi.edu
Thu Nov 5 21:18:52 UTC 2020


Hi There,

I am trying to switch between two structs as I am using the 
csvReader on a raw string. The pseudo-code below throws a "cannot 
implicitly convert" error due to difference between struct_type1 
and struct_type2. I must be doing something wrong or have a wrong 
understanding of how this function works. Could someone give a 
good suggestion on handling this?

Thanks!

Best,
Selim

auto records = rawtext.csvReader!struct_type1(';');
if(aControlCondition) {
records = rawtext.csvReader!struct_type2(';');
}

// Iterate through each data row.		
foreach (record; records) {
writeln(record);
}


More information about the Digitalmars-d-learn mailing list