|
Boost : |
Subject: Re: [boost] [Block Pointer] make_block
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2011-04-30 11:05:35
On 30/04/2011 02:38, Phil Bouchard wrote:
> On 4/29/2011 3:13 PM, Phil Bouchard wrote:
>> Hi,
>>
>> I just disabled the constructor and the assignment operator having a raw
>> pointers as a parameter and I added the make_block factory function. We
>> can see it in action in the following example:
>> https://svn.boost.org/svn/boost/sandbox/block_ptr/libs/smart_ptr/example/block_ptr_test1.cpp
>>
>
> It looks like the performance was better using operator new because of
> the lack of the need of temporaries:
>
> time of new block:
> 0.144u 0.016s 0:00.16 93.7%
>
> time of make_block:
> 0.328u 0.012s 0:00.34 97.0%
>
> Any thoughts?
There is no difference between
block_ptr<T> a = make_block<T>(whatever);
and
block_ptr<T> a(new block<T>(whatever));
Your temporaries in question are removed by NRVO.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk