From: John Potter (jpotter_at_[hidden])
Date: 2000-01-02 18:22:01
Please excuse me for butting in.
On Sun, 2 Jan 2000, Dave Abrahams wrote:
> > What do you think about a chaining of member function calls in general? $
> > never heard anything about this subject from any person who can made me $
> > my mind, so I'll glad to hear something about it from members of this gr$
> It's unfamiliar to me at least. There is a reason that it is often
> recommended that operator+= should return a const reference instead of a
> full reference: for compatibility with the built-in types. IOW, you can't
> write: int x = 0; (x += 3)++
You can if you add a semicolon ;) The built-in types produce lvalues.
This is undefined behavior of the form that I have never seen any
compiler do anything other than expected. With my limited experience,
I see no reason to do anything else. Chaining is also quite common.
You're just used to a different form.
int x = 0;
(x += 3)++;
The assignable requirements for container elements require a T&,
but I know of no place where a T const& would not work. No desire
to open an old debate. If it is policy, that is sufficient.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk