Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2024-04-01 07:15:03


Daniela Engert wrote:
> And possibly fall into a trap related to operators: *only* the (in)equality
> operators have the same behaviour as their std::
> counterpart, the other relational operators are either missing in
> boost::shared_ptr (by design!) but exist for std::shared_ptr, and have
> different behaviour. While both boost:: and std:: flavoured shared_ptrs are
> designed to be used as keys in associative containers, they order differently
> and have a different definition of equivalence. Other Boost libraries (like e.g.
> Signals2) depend on that. AFAIK, this isn't brought to attention anywhere (but
> what do I know).

The committee didn't like my operator< so they changed it, and added the
rest of the relationals. Removal would have been a better choice - there are
hardly any legitimate uses of p >= q. But it is what it is.

I can't "fix" this now because it will potentially introduce silent breakage
into a lot of existing code. The only thing I can do is delete operator< for
a decade or so until everyone stops using it, then maybe add the standard
behavior.


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