Boost logo

Boost :

Subject: Re: [boost] [cpo-proposal] presentation of the idea
From: Larry Evans (cppljevans_at_[hidden])
Date: 2013-08-22 12:27:23


On 08/22/13 10:38, Thorsten Ottosen wrote:
[snip]
>
>> OTOH, if only offsets were used, then wouldn't simply using
>> the vector<char>::swap work?
>
> Doesn't that have the same problems as memcpy'ing? That is, if we don't
> call the constructor, we don't get the implicit stuff inside the
> classes properly constructed.

OK. Maybe so. I was still under the impression that the only
problem with simply copying the old std::vector<char>::data() to
a new std::vector<char>::data() is that this could copy the
raw pointers verbatim which would mean those raw pointers
in the new std::vector<char>::data() would point somewhere
still in the old std::vector<char>::data(), which would be
invalid after the resize. OTOH, with offsets instead of
raw pointers, the offsets would be w.r.t. the
existing std::vector<char>::data(); hence, would still be
valid since offsets would remain invariant.

Although I haven't looked at, this looks like something
that could be used:

http://www.boost.org/doc/html/interprocess/offset_ptr.html

(Thanks to Bjorn Reese for sending me a private email
pointing to this reference).

-regards,

>
> regards
>
> Thorsten
>
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost
>


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