foreach (x; a .. b) and foreach_reverse (x; a .. b) should be disallowed for floats

Leandro Lucarella llucax at gmail.com
Mon May 18 08:05:55 PDT 2009


dsimcha, el 18 de mayo a las 14:58 me escribiste:
> 2.  Using retro() would not be a full replacement when it comes to arrays.  For
> example, you can't get the indices by doing a
> 
> foreach(i, elem; retro(someArray)) {}

Python has an "enumerate" function exactly for this. Is a generator that
returns a tuple with (index, element). That should be easily implemented
in D2 as a range, I guess.

-- 
Leandro Lucarella (luca) | Blog colectivo: http://www.mazziblog.com.ar/blog/
----------------------------------------------------------------------------
GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145  104C 949E BFB6 5F5A 8D05)
----------------------------------------------------------------------------



More information about the Digitalmars-d mailing list