
"Fredrik Blomqvist" <fredrik_blomqvist@home.se> wrote in message news:d43o6f$oia$1@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. Yes of course, but they still wont be used unless the container fwds to
Pavel Chikulaev wrote: them.
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, hmm, yes, I can see how it could be fairly error prone..
Thorsten, I guess, decided not to have comparison operators at all. My post was trigged by a note in the docs(?) suggesting they were supposed to be added. But now I can't seem to find a link to it again... (perhaps Thorsten updated some docs very recently?)
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. Couldn't the lib assume/trust them to be polymorphic in that case? (and as correct as such implementation allows)
BTW, you can always write our own comparison operators for ptr_containers of your classes if you really need them. Yes. Perhaps they could simply be put in a separate header to be pulled in if needed?
Regards // Fredrik Blomqvist