|
Boost : |
From: Pavel Chikulaev (pavel.chikulaev_at_[hidden])
Date: 2005-04-19 17:06:10
"Fredrik Blomqvist" <fredrik_blomqvist_at_[hidden]> wrote in message
news:d43o6f$oia$1_at_sea.gmane.org...
>I can't find any code or docs dealing with comparison in the current CVS.
> Weren't ptr_container supposed to have deep comparison semantics?
Even if it had, you should make sure that your classes have properly
implemented comparison operators. Otherwise only base class's parts
will be compared, and since such behaviour is undesirable and most users
don't need any comparison operators or simply won't write them or will write
them polymorphically incorrect, Thorsten, I guess, decided not to have
comparison operators at all.
For proper comparison you should ensure that you comparing objects of
the same dynamic type, then compare all base parts, the derived one.
Because of this, it's just not possible to write comparison operators for
ptr_container with every type you put in it.
BTW, you can always write our own comparison operators for ptr_containers
of your classes if you really need them.
For the same reason ptr_containers don't provide assignment operator.
-- Pavel Chikulaev
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk