Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2005-10-14 14:37:08


Jim Hyslop <jhyslop_at_[hidden]> writes:

> Robert Ramey <ramey <at> rrsd.com> writes:
>>
>> Here is the background/history.
> [...]
>> Jen's library had the & operator - which at first
>> surprised and confused me.
>
> My point exactly - has this group forgotten the Principle of Least
> Astonishment?

There's always a tension between innovation and familiarity.

> [...]
>> I suspected that the & operator
>> was chosen due to its operator precedence being at a particular spot in the
>> operator precedence hierarchy[...]
> Except that operator precedence only applies to "built-in" operators - user
> defined operators are function calls, and have that level of precedence.

No, that's wrong. In fact, IIRC, the C++ built-in operator bindings
can't be described correctly in terms of operator precedence, but you
can get pretty close. And to the extent you can get close,
user-defined operators bind exactly as the builtin operators of the
same names would.

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

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