Boost logo

Boost :

From: George A. Heintzelman (georgeh_at_[hidden])
Date: 2001-08-17 12:15:27


> // Revision History
> +// 17 Aug 01 added operator <, and got rid of std::swap and std::less
> since
> +// std::swap is already non-throwing for shared_ptr and
> operator <
> +// is better than specializing std::less (Darin Adler)

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

George Heintzelman
georgeh_at_[hidden]


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