Boost logo

Boost :

Subject: Re: [boost] [paired ptr] Proposing a new smart pointer object for managing bidirectional relationships between objects
From: Vicente Botet Escriba (vicente.botet_at_[hidden])
Date: 2010-05-04 04:29:59

Hi, I want to comment some of the "Further Thoughts And Future Development"
in the documentation. You said in the documentation

Dan Walters-2 wrote:
> 1. Does this library belong within the smart_ptr library? In many ways it
> is similar in mechanics to the smart_ptrs but in a few ways it is
> fundamentally different, particularly in interface where an owner and
> callbacks are specified. Could this library be brought to conform more
> closely with the other smart_ptrs so that it can be included in this
> library? Or should paired_ptr have a new home?

I'm not sure this smart pointer should be included in the Boost.SmartPtr
library. There are a lot of smart pointers to put all of them in
Boost.SmartPtr. I would put it is a specific library. Intrusive

Dan Walters-2 wrote:
> 2. Constructors and operators required. paired_ptrs need to be able to go
> in containers

to what constructors and operators are you referring to?

Dan Walters-2 wrote:
> 3. the sizeof<paired_ptr> is 4 pointers, so 16 bytes assuming 4 bytes per
> pointer. Two of these pointers are the connect and disconnect callbacks.
> Should there be a separate callback version allowing an 8 byte skinny
> version without callbacks?

I agree that the callback version must be separated from the simpler one.
Why do you need the owner? in which cases it is needed?

Dan Walters-2 wrote:
> 4. should callbacks also provide a pointer to the specific paired_ptr that
> invoked the callback? This could be useful if an object contains a dynamic
> container of type paired_ptr.

No I don't thisnk so, as this is already stored on the pointer.
Could you clarify your use case?

Dan Walters-2 wrote:
> 5. polymorphic usage. You should be able to do paired_ptr<CDog, CAnimal>
> ptr_A; paired_ptr<CDog, CCat> ptr_B; ptr_A = ptr_B;

Yes this is a must have.


View this message in context:
Sent from the Boost - Dev mailing list archive at

Boost list run by bdawes at, gregod at, cpdaniel at, john at