Try to compile this: import std.stdio;
auto xxx(T)() { return this; } struct S { mixin xxx!(typeof(this)); alias xxx this; } void foo(S pos) { writefln("(%.2f|%.2f)", pos.x, pos.y); } void main() { } Or this: import std.stdio; auto xxx(T)() if (is(T == struct)) { return this; } struct Vector2f { mixin xxx!(typeof(this)); alias xxx this; } void foo(ref const Vector2f pos) {} void main() { Vector2f v; foo(v); }