Derived type

novice2 sorryno at em.ail
Tue Mar 30 19:47:41 UTC 2021


My tries to make template for struct and alias this:

////// variant 1
template Typedef(alias Tnew, Tbase)
{
   struct Tnew
   {
     Tbase payload;
     alias payload this;
   }
}

Typedef!(Xobj, void*);

void foo (Xobj obj) {}  //compiler Error: no identifier for 
declarator Typedef!(Xobj, void*)


////// variant 2
mixin template Typedef(alias Tnew, Tbase)
{
   struct Tnew
   {
     Tbase payload;
     alias payload this;
   }
}

mixin Typedef!(Xobj, void*);  //compiler Error: undefined 
identifier Xobj




More information about the Digitalmars-d-learn mailing list