Templated class defaults and inheritence

Joerg Joergonson via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Jun 18 10:48:47 PDT 2016


This is solved through simple inheritance constraints and 
aliasing with qualification.


class X;
class subfoo;
class subbaz : subfoo;
class foo(T) if (is(T : subfoo)) X;
class baz(T) if (is(T : subbaz)) foo!T;

then when we need foo with "default",

alias foo = qualified.foo!subfoo;

Without the qualification, which I guess requires having this 
stuff in a separate module, there is no conflict. alias foo = 
foo!subfoo; fails circularly.









More information about the Digitalmars-d-learn mailing list