Using lazily ?
bioinfornatics
bioinfornatics at fedoraproject.org
Thu Mar 1 13:50:17 PST 2012
dear,
Noob question for know if D provide a shorter way i explain
we have a struct S:
struct S{
string member1;
string member2;
string member3;
}
we parse a file:
File f = File("a path", "r");
S s;
sise_t tokenLength = "member1".length;
foreach( char[] line; f.byLine() )
mixin("s." ~ line[0 .. tokenLength] ~ " = " ~ line[tokenLength ..
$]" ); // do not work because lien is not kno at compile time
I know this do not works i.e comment but it will save some line by
checking if is member1 2 or 3
They are a shorter way to do this use lazy ?
More information about the Digitalmars-d-learn
mailing list