extend foreach to work on non-arrays

Stefan Koch uplink.coder at googlemail.com
Fri May 25 10:12:47 UTC 2018


On Thursday, 24 May 2018 at 22:43:00 UTC, IntegratedDimensions 
wrote:
> Doesn't make any sense?
>
> foreach(a; x)
>
> if x is not an array then a = x and the loop reduces simply and 
> function to the case it is not so their can be no harm.
>
> It unifies the concepts so that one does not have to worry if x 
> is an array or not and can offer no harm since when x is not an 
> array everything simply reduces to an an alias of x.

please look at opApply.


More information about the Digitalmars-d mailing list