Using lazily ?

bioinfornatics bioinfornatics at fedoraproject.org
Thu Mar 1 14:25:12 PST 2012


Le jeudi 01 mars 2012 à 23:10 +0100, Timon Gehr a écrit :
> S s;
> size_t tokenLength = "member1".length;
> void main(){
>      foreach(char[] line; stdin.byLine())
> foreach(m;__traits(allMembers,S)){
>          if(line[0..tokenLength] == m) mixin("s."~m) =
> line[tokenLength 
> .. $].idup;
>      }
> } 

awesome :)

can use hasMember instead allMembers ?



More information about the Digitalmars-d-learn mailing list