Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2002-10-13 07:52:45


Daniel Frey <d.frey_at_[hidden]> writes:

> The point IMHO is, that taking the parameter by value may lead to equally
> optimized code for *some* cases. For the general case, only the NRVO may
> lead to optimized code for all cases. And a function which takes a const
> T& and makes a copy of it is IMHO not lying. If it makes a copy, it's an
> implementation detail. I have seen implementation of operator+ which don't
> make a copy of the arguments, but why should all these details be
> reflected in the function's signature?

Furthermore, if the function being called is not inlined,
pass-by-const& can result in a whole lot less code being generated
than if pass-by-value is used.

-- 
           David Abrahams * Boost Consulting
dave_at_[hidden] * http://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