Boost logo

Boost :

From: George A. Heintzelman (georgeh_at_[hidden])
Date: 2001-12-07 11:40:50


Hi boosters,

I'm doing some work trying to get various boost things working for
SunCC, version 5.3. As I find and hopefully fix things, I'll let you
know.

This message is about the fact that even in the most recent versions of
SunCC, BOOST_NO_PARTIAL_SPECIALIZATION is set. There's a comment by
Jens Maurer that:

       // 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? Is the intention to
get argument-dependent-lookup if the user has provided NS::less<NS::T *>
? If so, would

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
      { using std::less; return less<T*>()(a.get(),b.get()); }
  };

(which also works on this compiler) be better? Both fixes also compile
the regression for g++ on this platform, which (unfortunately) is all I
have access to.

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