Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2001-05-24 12:31:28

From: <williamkempf_at_[hidden]>

> Sometimes it's valid to have less<type> but not operator<(type,
> type). Not that this is such a case, but it makes it less likely
> that a "dangerous precedent" is being set.

No, it's never valid to have less<type> but not operator<. The only
exception is for pointers that don't point into the same array.

> > Consider this case:
> >
> > shared_ptr<A> pa;
> > shared_ptr<B> pb;
> >
> > Do pa and pb point to the same object? No way to tell without
> comparing
> > and
> I don't get this. Take shared_ptr<> out of the equation and you get
> this:
> A* pa;
> B* pb;
> Do pa and pb point to the same object now?

I don't know.

> If you can figure this
> out then you can figure it out for shared_ptr<> by using get(), and
> if you can't than shared_ptr<> shouldn't allow you to figure it out
> either.

shared_ptr is a bit different from a raw pointer. It reperesents shared
ownership. I ask the legitimate question "do pa and pb share ownership?"

Peter Dimov
Multi Media Ltd.

Boost list run by bdawes at, gregod at, cpdaniel at, john at