Boost logo

Boost :

From: Andrei Alexandrescu \(See Website for Email\) (andrewalex_at_[hidden])
Date: 2004-07-07 11:51:23

"David Abrahams" <dave_at_[hidden]> wrote in message
> IMO it's only a valid coding standard if you also have a coding
> standard that says "operators must always act the same on user-defined
> types as they do on the builtins" -- which I would never accept ;-)
> Probably the right standard is:
> "If you're trying to define operators that act like the
> builtin ones, beware the overloading of operator,, operator&&
> and operator||, because you can't get identical semantics".
> But then, why would anyone want to overload operator, other than to
> change the semantics??

That argument doesn't hold water. You do want to change the semantics, but
not in ways that can be confusing or introduce subtle nonportabilities.
Unlike all other overloadable operators, the three operators you mention
have special regime in the way they evaluate their arguments, regime that
cannot be emulated with regular function calls.

That being said, I take it your answer was (a): it is an obsolete coding
standard. Thanks. Any other votes and opinions are welcome.


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