|
Boost : |
Subject: Re: [boost] [cpo-proposal] presentation of the idea
From: Larry Evans (cppljevans_at_[hidden])
Date: 2013-08-27 08:09:08
On 08/27/13 06:44, Thorsten Ottosen wrote:
> On 23-08-2013 17:08, Larry Evans wrote:
>
>> AFAICT, this shows the offset_ptr would solve the problem of moving
>> the storage in case the storage needs to be resized.
>>
>> Am I missing something?
>
> I can't tell. Some interprocess experts might want to way in here?
>
> Anyway, I can live with a container that has unstable
> pointers/references after push_back. std::vector<T> is like that,
> so what's exactly the difference here?
>
The offset_ptr<polymorophic_object> solves the unstable
pointer problem caused by moving the storage buffer.
That's one problem 1st mentioned by Rob Stewart here:
http://article.gmane.org/gmane.comp.lib.boost.devel/243582
and then again by Ben Pope here:
http://article.gmane.org/gmane.comp.lib.boost.devel/243633
The code I last posted shows the offset_ptr still points to
the *this even after the move, although the raw pointer
points to the old location. Also, no virtual methods are
needed to preserve this stable pointer feature. Using
just offset_ptr seems to do the job.
-regards,
Larry
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk