July 14, 2013
On 07/14/2013 11:37 AM, lomereiter wrote:
>> I assume that you template ends up creating a dummy interface though
>> and this isn't really acceptable.
>
> Yes, it does. Once ':' is typed, some inheritance must occur.
>

Nope.

template Seq(T...){ alias T Seq; }

class C : Seq!(){ }


> Why isn't a dummy interface acceptable?

It creates unnecessary bloat.

template conditionallyInherit(bool inherit, T) {
    static if(inherit) alias T conditionallyInherit;
    else alias Seq!() conditionallyInherit;
}

July 15, 2013
Thanks.
Now I realise that D is much less intuitive than C++.
1 2
Next ›   Last »