Boost logo

Boost :

From: David Abrahams (david.abrahams_at_[hidden])
Date: 2002-07-03 07:38:25


From: "Peter Dimov" <pdimov_at_[hidden]>

> > Why not use:
> >
> > friend const T operator+ (const T& lhs, const T& rhs)
> > {
> > return T(lhs) += rhs;
> > }
> >
> > doing away with the named temporary, and possibly using normal return
> value optimization?
>
> Because this assumes that the compiler knows that T::operator+= returns
> *this.

Good point.

-Dave


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