Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2004-08-07 12:31:07

Rob Stewart <stewart_at_[hidden]> writes:

> From: Tylo <tylo_at_[hidden]>
>> I propose this usage (for shared_ptr):
>> shared_ptr<Widget> wp1 = NULL; // 1a


>> 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

> 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

Boost list run by bdawes at, gregod at, cpdaniel at, john at