I'm trying creating template for intrusive double-linked list:

mixin template node() {
  static if(is(this == struct))
    alias typeof(this)* E;
  else
    alias typeof(this) E;
  E prev, next;
}

struct list(alias N) {
  N.E head;
  N.E tail;
}

class A {
  mixin node;
}

list!A l;

All works great.
If it's need to store one object in two different lists I plan something like this:

class A {
  mixin node L1;
  mixin node L2;
}

list!(A.L1) l1;
list!(A.L2) l2;

But compiler doesn't compile that whith error:
"this is not in a class or struct scope|"
in line with
"alias typeof(this) E;"

Reply via email to