Boost logo

Boost :

Subject: Re: [boost] [Block Pointer] Review Request
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2011-05-02 17:35:39


On 02/05/2011 21:32, Phil Bouchard wrote:
> On 5/2/2011 10:09 AM, Mathias Gaunard wrote:
>>
>> Order of instantiation is irrelevant outside of RAII management
>> patterns, since an object may outlive its creator (that's the point).
>
> If block A was instantiated first then block A is necessarily the parent
> of block B.
>
>> What do you mean by the block_ptr will be invalidated? The pointer will
>> be set to zero?
>
> Precisely.
>
>> So that's something any user should be ready for, check block pointers
>> are non-zero in destructors?
>
> It's already done implicitly in the destruction of the block_ptrs. Right
> before they'll be destroyed the pointer will still refer to the
> deallocated memory block.

Right, but the user could still try do do
some_block_ptr->some_member_function()

if some_block_ptr is null, this will lead to an error.

You should talk about this in the documentation.


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