readonly?

Tobias Pankrath tobias at pankrath.net
Wed Jul 11 00:00:26 PDT 2012


On Wednesday, 11 July 2012 at 06:48:59 UTC, David Nadlinger wrote:
> On Wednesday, 11 July 2012 at 06:34:29 UTC, Tobias Pankrath 
> wrote:
>>> This escapes a stack reference.
>>
>> Ins't b supposed to be allocated on the heap?
>
> The Bar instance is, but the pointer to it is not. Making _b a 
> Rebindable instead of using a pointer (to what effectively is a 
> pointer to the real object) should help.
>
> David

Bar b = new Bar;
auto b2 = &b; // type of b2 is Bar*

So does it meen, that a pointer of type Bar* does not point to 
the real object?
How do I get such a pointer then and which type does it have?



More information about the Digitalmars-d-learn mailing list