|
Boost : |
Subject: Re: [boost] [Shifted Pointer] Review Request
From: Jeremy Maitin-Shepard (jeremy_at_[hidden])
Date: 2011-04-22 03:03:39
On 04/21/2011 11:17 PM, Phil Bouchard wrote:
> On 4/21/2011 10:53 PM, GMan wrote:
>>
>> I haven't looked too deeply into it, but this syntax seems scary:
>>
>> shifted_ptr<int> v = new shifted<int>(11);
>>
>> Is there a way to hide that detail? Perhaps construct with values which
>> internally store shifted<T> from that value? Just seems error prone
>> and unintuitive.
>
> You are referring to intrusive members and this is the approach taken by
> intrusive_ptr<>. Intrusive members become a problem when multiple
> inheritance is used and/or virtual inheritance because the intrusive
> member might or might not be duplicated in the object.
>
> Perhaps an abbreviation can be used but for now this is the price to pay
> to use Shifted Pointer.
I think he is just suggesting to replace
"new shifted<T>(...)"
with
"make_shifted<T>(...)"
or something similar, where make_shifted returns a shifted_ptr<T>
directly rather than a raw pointer to shifted<T>.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk