foreach_reverse is better than ever

grauzone none at example.net
Sun Feb 14 03:27:49 PST 2010


Lars T. Kyllingstad wrote:
> Andrei Alexandrescu wrote:
>> Gone, that is. Walter agreed to remove it.
>>
>> To achieve the functionality of
>>
>> foreach_reverse (r) { ... }
>>
>> use
>>
>> foreach (retro(r)) { ... }
>>
>> using retro in std.range.

Now all what's left to do is to make it as efficient as the builtin 
functionality.

> 
> Let me first say that I think it's great that one of D's ugliest 
> keywords is going away. But does retro (or ranges in general) support 
> iteration over both index and element?
> 
>   foreach_reverse(i, e; foo) { ... }

And will it be able to parse utf-8 backwards?

I assume proper utf-8 support with ranges (or whatever is planned) isn't 
implemented yet, so I didn't test it.

> -Lars



More information about the Digitalmars-d mailing list