On 06/16/2012 09:55 PM, F i L wrote:
Timon Gehr wrote:
'typeof(this)' can be used to avoid stuttering the type at the mixin
location.
mixin template Pool() { mixin Pool!(typeof(this)); }
class MyOtherClass {
mixin Pool;
}
For some reason I was under the impression that typeof(this) couldn't be
resolved in this situation (no 'this' value),
It is indeed special cased.
class S{
pragma(msg, typeof(this)); // ok
pragma(msg, this.stringof);
// Error: 'this' is only defined in non-static member functions, not S
}
but I'm sure you're
correct here. Which of course means you'd need to "static
if(isValueType!typeof(this)) { ... } else { ... }" to make it work with
structs.