On Wednesday, 14 December 2016 at 19:39:55 UTC, Andrei Alexandrescu wrote:
On 12/14/2016 02:04 PM, Meta wrote:
On Wednesday, 14 December 2016 at 17:32:10 UTC, H. S. Teoh wrote:
What about:

    /* Showing full declaration just for context */
    bool myFunc(R1, R2)(R1 r1, R2 r2)
    import {
        std.range : isInputRange,
        std.traits : isNum = isNumeric
    }
    if (isInputRange!R1 && isInputRange!R2 &&
        isNum!(ElementType!R1))
    in { assert(someCondition!R1); }
    out(result) { assert(result == expectedResult(...)); }
    body
    {
        ...
    }


as ketmar said, would the import block have any restrictions what code could be used inside, would this work?

T1 fun(T1, T2)(T1 t1, T2 t2)
import
{
    version(A) { someMod: T1, T2; }
    else { someOtherMod: T1, T2; }

    // static if or any other code?
}
{
    T1 ret = t1 + t2;
    return ret;
}

Reply via email to