why mixin template can not inclulde statement;

Kagamin spam at here.lot
Fri Aug 10 13:05:24 UTC 2018


Mixim template can only introduce declarations, not statements, a 
workaround is a lambda called in place.

mixin template test(A...){
         __gshared a = A;
         int dummy = (){ a++; return 0; }();
}

extern(C) void main(){
         mixin test!123;
}


More information about the Digitalmars-d-learn mailing list