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


Reply via email to