"this" member for structs with methods

simendsjo simendsjo at gmail.com
Sun Mar 17 05:16:07 PDT 2013


When a struct contains methods, __traits(allMembers reports a 
member called "this". What is "this"?

void main() {
     struct S { int i; }
     struct A { int i; void f() {} }
     pragma(msg, __traits(allMembers, S)); // i
     pragma(msg, __traits(allMembers, A)); // i, f, this
}


More information about the Digitalmars-d-learn mailing list