foreach

Nick Treleaven via Digitalmars-d digitalmars-d at puremagic.com
Thu Jun 12 10:30:30 PDT 2014


On 12/06/2014 17:59, bearophile wrote:
>> there is also this usage:
>>
>> foreach (i, _; range){...}
>
> I think this is a very uncommon usage. I think I have not used it so far.

Perhaps with something other than a range then. There are some uses in 
Phobos:

std/algorithm.d:        foreach (i, _; args)
std/exception.d:        foreach (index, _; FieldTypeTuple!C)
std/typecons.d:        foreach (i, _; Tup1.Types)
std/typecons.d:        foreach (i, _; Tup1.Types)
std/typecons.d:                foreach (i, _; Types)   // Rely on the 
field layout
std/typecons.d:            foreach (i, _; Types)
std/variant.d:        foreach (i, _; params)



More information about the Digitalmars-d mailing list