Boost logo

Boost :

From: Greg Colvin (gcolvin_at_[hidden])
Date: 2001-08-17 13:38:55


From: "Jon Kalb" <jonkalb_at_[hidden]>
> > -----Original Message-----
> > From: Peter Dimov [mailto:pdimov_at_[hidden]]
> > Sent: Friday, August 17, 2001 10:32 AM
> > To: boost_at_[hidden]
> > Subject: Re: [boost] smart ptr changes
> >
> > From: "George A. Heintzelman" <georgeh_at_[hidden]>
> > > Why get rid of the std::swap specialization? Although it is
> > > unnecessary for good exception safety, it is going to be
> > faster than
> > > the default version, since you avoid several increments and
> > decrements
> > > of the reference counts (admittedly a compiler can optimize those
> > > away, but why force it to?). Since it is already written and works,
> > > you may as well leave it. There aren't any issues with specializing
> > > this in std::, are there? shared_ptr<x> is a UDT, so it should be
> > > legal...
> >
> > A specialization would be legal. However std::swap is a
> > function template and the language does not support partial
> > function template specializations.
> >
> > http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/lwg-active.html#226
> > http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/papers/2001/n1296.htm
>
> As a boost library it isn't legal, but it could be left in for the
> proposal to the LWG. Surely they aren't bound by this.

Right. Also, this is an open issue, and in my opinion it is just
stupid that users can't specialize swap.

So my inclination is to leave it in the Boost version, and config
it away if some system chokes on it. It is isn't really part of
the user interface, just a performance hack.


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