Conditional Inheritance

JS js.mdnq at gmail.com
Sat Jul 13 22:35:35 PDT 2013


On Sunday, 14 July 2013 at 05:28:08 UTC, lomereiter wrote:
> This should work:
>
> template conditionallyInherit(bool inherit, T) {
>     static if (inherit)
>         alias T conditionallyInherit;
>     else
>         interface conditionallyInherit {}
> }

Thanks, I tried something similar but it didn't work right...

I assume that you template ends up creating a dummy interface 
though and this isn't really acceptable.

e.g., interface A : conditionallyInherit!(false, B) { }

will cause A to inherit from conditionallyInherit?



More information about the Digitalmars-d-learn mailing list