Boost logo

Boost :

From: Daniel Frey (d.frey_at_[hidden])
Date: 2008-07-28 16:54:13


On Mon, 2008-07-28 at 23:01 +0300, Peter Dimov wrote:
> Daniel Frey:
>
> > What about b) from my previous mail? Am I misreading the documentation
> > (N2352/N2691)?
>
> N2691 is clear that there is only one std::make_shared. boost::make_shared
> has a zero-argument overload because g++ incorrectly translated new
> T(args...) to new T in the zero case. I don't know whether this has been
> fixed.

Just to clarify: We are talking about 5.3.4/15, i.e., in case of PODs
new T does leave it uninitialized, while new T() default constructs it,
right?

As a solution in order to fulfill N2691, wouldn't it be easier to fix it
inside the function, by simply doing:

if( sizeof...( Args ) == 0 )
  new( pv ) T();
else
  new( pv ) T( detail::forward<Args>( args )... );

with an appropriate comment that it's GCC's fault?

Regards, Daniel


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk