Out of order execution

Joerg Joergonson via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Jun 15 18:57:19 PDT 2016


Suppose I have a loop where I execute two functions:

for(...)
{
    if (x) Do1(x);
    if (y) Do2(y);
}

The problem is, I really always want to execute all the Do2's 
first then the Do1's. As is, we could get any order of calls.

Suppose I can't run the loop twice for performance reasons(there 
is other stuff in it) and I don't want to store the state and 
call info then sort them out afterwards.

Is there an efficient lazy way to make this happen?




More information about the Digitalmars-d-learn mailing list