Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2002-02-09 11:16:30


From: "David Abrahams" <david.abrahams_at_[hidden]>
> From: "Peter Dimov" <pdimov_at_[hidden]>
> > The current ==, != operators compare get(); there wasn't a particularly
> > strong reason to break backward compatibility by making them compare the
> > count.
>
> Considering that shared_ptr<> implicit upcasts now actually *work*, it
seems
> like a good idea to make comparisons work, too. I don't see how it's going
> to break backwards compatibility, anyway. What am I missing?

Hmm.

We now have

template<typename T, typename U> inline bool operator==(shared_ptr<T> const
& a, shared_ptr<U> const & b)
{
    return a.get() == b.get();
}

that works for different T and U, but only when the pointer comparison is
legal.

Are you suggesting that we make operator== work for any unrelated T and U by
comparing the count? It can be done but the NULL needs to be handled
separately fro compatibility.


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