Boost logo

Boost :

From: Jan Langer (jan_at_[hidden])
Date: 2003-03-27 16:51:35

Gennaro Prota wrote:
> Well, if we are really going to discuss such quibbles, I would also
> change "zero" to "equiv" because that's the usual "term" used for
> strict weak ordering. And I would avoid constructs like
> template <typename T>
> compare (T const &a, T const &b)
> : v_ (compare () (a, b).v_) // <--
> {}
> by doing, for instance,
> class compare
> {
> enum result { minus, equiv, plus };
> result v_;
> template <typename T>
> static result do_compare(const T& a, const T& b) {
> if (a < b) return minus;
> else if (b < a) return plus;
> return equiv;
> }
> public:
> };

ok, i didnt think too long about the implementation quality. but i will
change it for the next time.

> But there are more important points I think; first of all this: if all
> I can see "from the outside" is whether v_== minus [note: this is
> 'plus' in the original code] why keeping three states internally?

because i see no reason why they should be needed. and i can also
exchange the meaning of plus and minus, if it is prefered.

jan langer ... jan_at_[hidden]
"pi ist genau drei"

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