"Eric Friedman" <[EMAIL PROTECTED]> writes: > 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?
Arrange for a compile-error if x <= 3 is legal for more than one of the types in the variant? -- Dave Abrahams Boost Consulting www.boost-consulting.com _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost