Boost logo

Boost :

Subject: Re: [boost] root_ptr only on stack? (was Re: [Root Pointer] Seeking a Review Manager
From: Phil Bouchard (philippeb8_at_[hidden])
Date: 2016-04-03 13:59:04


On 04/03/2016 12:31 PM, Larry Evans wrote:
> On 04/01/2016 12:25 AM, Phil Bouchard wrote:
>> Greetings,
>>
>> - "Root Pointer" is an alternative to the long unsolved problem of
>> garbage collectors which lasted for more than 70 years!
>>
>>
>> - Thanks to Paul A. Bristow for his help on the generation of the
>> documentation which is now available at the following link:
>> http://philippeb8.github.io/root_ptr/
>>
> Judging just from:
>
> http://philippeb8.github.io/root_ptr/root_ptr/rationale.html
>
> I would guess a root_ptr *must* be on the stack.
> However, I didn't find anything in the following:
>
> https://github.com/philippeb8/root_ptr/blob/master/include/boost/smart_ptr/root_ptr.hpp
>
> http://philippeb8.github.io/root_ptr/header/boost/smart_ptr/root_ptr_hpp.html
>
> to support this.
>
> Could you please clarify?

No root_ptr doesn't necessarily need to be on the stack; it can be a
member of a container class allocated on the heap for example.

So a root_ptr will most likely be either allocated on the stack, the
data segment or a class member allocated on the heap. It is a "root"
and once destroyed all associated node_ptr are guaranteed to be wiped
out as well.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk