Iterating over the tupleof of a struct
    Suliman via Digitalmars-d-learn 
    digitalmars-d-learn at puremagic.com
       
    Fri Aug 22 23:18:25 PDT 2014
    
    
  
How can I feel struct with foreach loop?
struct ConfigStruct
{
     string [string] key1;
     string [string] key2;
}
ConfigStruct confstruct;
foreach (i, line; readText(ConfigName).splitLines())
{
string [] keyvalue = line.split("=");
confstruct.key1[keyvalue[0]] = keyvalue[1];
}
it's ok for 1 key, but I need iterate through all element of 
struct. For make it's simply let's assume that spited lines are 
equal йшер number of elements in struct.
    
    
More information about the Digitalmars-d-learn
mailing list