|
Boost : |
From: Jan Langer (jan_at_[hidden])
Date: 2003-03-28 23:51:34
Gennaro Prota wrote:
> Ok. This is my last post in this thread. Let me just add that your
> conversion function to bool, together with the default constructor you
> provide, lets the user take the "result of the comparison" without
> actually doing any call to operator().
yes. but i cant see a problem with that. it is just as doing
lexicographic_compare with two empty sequences.
> class compare
> {
> public:
> enum result { minus, equiv, plus };
>
> private:
> class R {
> [...]
> operator result() const { return v_; }
>
> };
>
> mutable R result_;
> [...]
> };
ok. assuming that we want to convey all three states to the public. and
i want the bool-conversion semantik to be the same. why do you think an
implicit conversion to result is the right way?
i can also think of an function
result get_result () const { return v_; }
or three single functions for each state
bool minus () const;
bool plus () const;
bool equiv () const;
another idea would be to make it two classes compare and compare_3way.
one with the bool conversion and one with the implicit operator result.
jan
-- jan langer ... jan_at_[hidden] "pi ist genau drei"
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk