Freelists and clear/emplace

F i L witte2008 at gmail.com
Sat Jun 16 12:55:47 PDT 2012


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), 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.




More information about the Digitalmars-d mailing list