Boost logo

Boost :

From: Eric Friedman (ebf_at_[hidden])
Date: 2003-09-01 19:42:20


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
    ...

While the obvious objection is "but operator< isn't meant for
variant-nonvariant comparison," I don't see how to prevent it since variant
has implicit constructors.

Ideas?

Thanks,
Eric


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