On 9/19/13 1:02 PM, Andrej Mitrovic wrote:
On 9/19/13, Andrei Alexandrescu <[email protected]> wrote:
I'm not sure I understand how that would work.

-----
module test;
[snip]

Thanks, that's the simplest and most effective. I reduced it to:

struct A
{
    enum hasState = false;
    private mixin template funDef()
    {
        void fun(int x) { writeln(x); }
    }
    static if (hasState)
        mixin funDef!();
    else
        static mixin funDef!();
}

void main()
{
    A a;
    a.fun(42);
}

I see no way to extract the scaffolding into a library.


Andrei

Reply via email to