How about a special null template parameter?
Timon Gehr via Digitalmars-d
digitalmars-d at puremagic.com
Fri Aug 19 14:07:42 PDT 2016
On 19.08.2016 20:25, Engine Machine wrote:
> So we can create types relationships easier:
>
> class Type(T) : Type!null
> {
> int x;
> static if (T is Dog)
> int y;
alias Seq(T...)=T;
template TypeParent(T...) if(T.length==1){
static if(is(typeof(T[0])==typeof(null))) alias TypeParent = Seq!();
else alias TypeParent = Seq!(Type!null);
}
class Type(T...): TypeParent!T if(T.length==1){
int x;
static if (T is Dog)
int y;
}
More information about the Digitalmars-d
mailing list