
7 Aug
2004
7 Aug
'04
5:31 p.m.
Rob Stewart <stewart@sig.com> writes:
From: Tylo <tylo@start.no>
I propose this usage (for shared_ptr):
shared_ptr<Widget> wp1 = NULL; // 1a
<snip>
Current shared_ptr usage:
shared_ptr<Widget> wp1( NULL ); // 2a
Lines 1a and 2a are just the difference between assignment and initialization syntax.
It's the difference between copy initialization and direct initialization.
The former can be slower than the latter, though the difference may be optimized away.
On many compilers where there is a difference, copy initialization is actually faster than direct initialization. -- Dave Abrahams Boost Consulting http://www.boost-consulting.com