Boost logo

Boost :

From: Dave Abrahams (abrahams_at_[hidden])
Date: 1999-11-11 00:46:17

> ivan66_at_[hidden] wrote:
>> I assume that it would be legal to compare a shared_ptr<Derived> with a
>> shared_ptr<Base>? Also, that a shared_array<Base> could be compared to
>> a shared_array<Base>,
> It depends on the declaration of op== (member or non member).
> 1) member: conversions allowed on rhs but not lhs
> => base == derived passes
> but derived == base fails
> => very strange dissymmetric effect
> 2) non member: no conversions at all
> => symmetry in that base == derived and derived == base
> both fail the same way

They could also be defined to succeed (symmetrically) in the same way, using
either approach. All that's needed is a member template op==().


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