(St)Range behavior

Meta jared771 at gmail.com
Fri Oct 25 05:57:49 PDT 2013


On Friday, 25 October 2013 at 11:06:18 UTC, Chris wrote:
> I have three lazy ranges tied together in a foreach loop like 
> so:
>
> Item[] items; // An array of Item-struct
>
> foreach (item; items.range1.range2.range3) {
>   // ...
> }
>
> The funny thing is that when I run the foreach loop it does 
> everything in reverse. So I changed it to
>
> foreach (item; items.range3.range2.range1) {
>   // ...
> }
>
> And now it works as expected. I've never had such strange 
> behavior and have no clue what could have caused it. In all my 
> other ranges it works from left to right 1. step, 2. step, 3. 
> step and not from right to left.

Can you post some code?


More information about the Digitalmars-d mailing list