9 Feb
2016
9 Feb
'16
9:06 p.m.
On Tue, Feb 9, 2016 at 5:02 PM, Peter Dimov
// 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().