Freelists and clear/emplace
Timon Gehr
timon.gehr at gmx.ch
Sat Jun 16 13:03:31 PDT 2012
On 06/16/2012 10:02 PM, Timon Gehr wrote:
> 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
> }
>
That example actually compiles, but I'd consider that a bug. Removing
".stringof" makes it fail as expected.
More information about the Digitalmars-d
mailing list