|
Boost : |
Subject: [boost] [Block Pointer] Update
From: Phil Bouchard (philippeb8_at_[hidden])
Date: 2016-03-09 23:28:24
Hi,
- So I've restructured all the code in the correct namespaces
boost::smart_ptr & boost::smart_ptr::detail:
https://github.com/philippeb8/block_ptr/tree/master/include/boost/smart_ptr
- I am now using another smart pointer to refer to proxies because it is
safer but the code is 15% slower than without it (now ~= shared_ptr<>):
make:
auto_ptr: 26211292 ns
shared_ptr: 27291607 ns
block_ptr: 61097868 ns
new:
auto_ptr: 23240569 ns
shared_ptr: 48016207 ns
block_ptr: 55554121 ns
- Because of the removal of the proxy optimization there is a new
caveat; if you assign an rvalue (temporary pointer on the stack) to a
pointer on the heap (opposite of normal heap object assigned to stack
pointer) then there the behavior will be undefined. I am looking to fix
it or throw an exception but for now it's better not to use rvalues when
assigning to pointer living on the heap as such:
https://github.com/philippeb8/block_ptr/blob/master/example/t100_test1.cpp#L32
Regards,
-Phil
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk