Boost logo

Boost :

From: Darin Adler (darin_at_[hidden])
Date: 2001-12-07 12:48:23


On 12/7/01 8:40 AM, "George A. Heintzelman" <georgeh_at_[hidden]> wrote:

> // SunPro 5.3 has better support for partial specialization,
> // but breaks when compiling std::less<shared_ptr<T> >
>
> In hopes of getting rid of this limitation, I looked carefully at that
> particular line, and I found that SunCC compiles it just fine if we
> explicitly qualify the call to std::less as below:
>
> template<typename T>
> struct less< boost::shared_ptr<T> >
> : binary_function<boost::shared_ptr<T>, boost::shared_ptr<T>, bool>
> {
> bool operator()(const boost::shared_ptr<T>& a,
> const boost::shared_ptr<T>& b) const
> { return std::less<T*>()(a.get(),b.get()); }
> };
>
> So I ask -- is there a reason *not* to qualify it?

I can give you one piece of fairly good news. It turns out that partially
specializing std::less is no longer considered the best way to make
shared_ptr work properly with the standard algorithms.

Coming soon from Peter Dimov is a new version of shared_ptr that implements
operator < instead of specializing std::less.

    -- Darin


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