Boost logo

Boost :

Subject: Re: [boost] [block_ptr] Request for a review manager
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2016-02-09 16:06:06


On Tue, Feb 9, 2016 at 5:02 PM, Peter Dimov <lists_at_[hidden]> wrote:
>> // do something that allocates from the heap
>>
>> v.emplace_back( new X );
>>
>> The last line constructs a block_ptr<X> inside the vector's allocated
>> memory, which is on the heap. So the block_ptr goes looking for a previous
>> heap allocation and finds some random one.
>
>
> Ah wait, the last allocation is "new X" here. Hmm.

You can't tell that without seeing X's constructor. It may well be
another allocation that is performed in X().


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