On Sunday, 2 November 2014 at 11:46:19 UTC, Marc Schütz wrote:
I think DMD doesn't generate good code for it; IIRC it lowers scope(success) to a strange construct with an invisible variable and a try/catch. Don't know the reasons for this, maybe it has changed by now. Theoretically it would just need to move the contents of the scope(success) after the evaluation of the returned expression, which is cheap.

Are there cases in LDC where

    auto e = r.moveFront;
    r.popFront;
    return e;

generates code less efficient than

    scope(success) r.popFront;
    return r.moveFront;

because of the extra assignment?

Reply via email to