Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2003-09-02 06:50:57


Eric Friedman wrote:
> Peter Dimov wrote:
> [snip]
>> Provide operator<. Wait six months. Collect feedback. If there is
>> evidence that operator< is evil, remove it and document why it is
>> not supplied.
>
> OK, I'm willing to go along with this. I'll probably also include
> operator==, with a similar plan for future evaluation.
>
> Early evidence that operator< is evil though may be demonstrated in
> the following:
>
> boost::variant<int, double> var(3.0);
> ...
> if (var <= 3) // false

This is a potential problem, I agree. Or rather, this:

    if(var < 4)

is a potential problem.

If it causes problems in practice, we might need to add

    void operator<(variant, everything);
    void operator<(everything, variant);

to introduce ambiguities.


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