Boost logo

Boost :

From: Bill Klein (bill_at_[hidden])
Date: 1999-11-09 20:47:09


>Hmm. I had assumed that this
>
> a == b
>
>would compare the pointers and this
>
> *a == *b
>
>would compare the objects.

Perhaps I should have elaborated. What if, for example,
you wanted to maintain a sorted vector of these shared
pointers? You *could* still do it your way by creating
a comparison function/functor and using it for the sort
and for every call to find(), etc. But isn't it nicer
to be able to define the operators == and < etc and use
the non-comparison-function-expecting versions of all
the calls?

Another thing to keep in mind is that a lot of non-STL
code expects those standard operators for comparison
Maybe I'm old fashioned liking doing things that way
when I can: I can certainly understand the counter argument.

-Bill Klein <bill_at_[hidden]>


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk