Foreach type infering only works up to 2 levels?

Andrej Mitrovic andrej.mitrovich at gmail.com
Wed Feb 2 11:16:09 PST 2011


int[][][][] multiArray;

void main()
{
    foreach (one, two; multiArray)  // ok
    {
    }
    
    foreach (one, two, three; multiArray)  // fail
    {
    }    
}

test.d(13): Error: cannot infer type for two
test.d(13): Error: cannot infer type for three

Same thing happens with hashes as well. Is this a limitation in the language or a bug?


More information about the Digitalmars-d-learn mailing list