From: Peter Dimov (pdimov_at_[hidden])
Date: 2000-09-08 10:10:35
> It's only a problem until one decides whether or one dealing with
> identity-based or value-based objects. The pitch I'm hearing for ref<>
> is that it's value-based: If that is true, what are the good arguments
> in favour of identity-based equality?
ref is value-based. The problem is that it can hold anything - the
'benefits' of dynamic typing. Two distinct ref's can compare equal if one of
them is a copy of the other, even when they hold identity-based objects, in
the case they indeed refer to the same object. (I'm assuming a reference
This is not limited to the default operator==.
> Why not choose the simpler option? Don't put it in. Provide the user
> with a facility that is as clear as it could possibly be.
What technical problem would that solve?
> I think you misunderstand the issue: It is not whether or not an order
> can be specified for types, it is whether such an ordering deserves to
> be called operator<, especially if it is unspecified.
The motivation for ref::op< is that it is implemented in terms of the
contained objects' operator<.
In other words, if you have a bunch of ref's that hold values of the same
type, their op< mimics the statically-typed version (if it exists.)
-- Peter Dimov Multi Media Ltd.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk