Boost logo

Boost :

From: ivan66_at_[hidden]
Date: 1999-11-09 21:20:12

bill klein <bil-_at_[hidden]> wrote:
original article:
> >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]>
If operator== were defined in the boost library as a non-member
template, then you could specialize it for your particular type to give
it the semantics you want when you need them. Would that satisfy your

-- Ivan J. Johnson

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