Template mixin identifier as template alias parameter
Jacob Carlborg
doob at me.com
Sun Nov 11 02:36:41 PST 2012
On 2012-11-11 10:04, Jack Applegame wrote:
> 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;
> }
> class A {
> mixin node L1;
> mixin node L2;
> }
This won't work. The "node" template doesn't evaluate to a type and you
wouldn't use it as a mixin if it did.
> But compiler doesn't compile that whith error:
> "this is not in a class or struct scope|"
> in line with
> "alias typeof(this) E;"
>
--
/Jacob Carlborg
More information about the Digitalmars-d-learn
mailing list