Boost logo

Boost :

From: Simonson, Lucanus J (lucanus.j.simonson_at_[hidden])
Date: 2008-05-22 15:49:41


John Moeller wrote:
>One more thing. The argument is passed by value, which is ok for
builtins.
>Will all those potentially excess temporaries be an issue for larger
UDTs?
>Perhaps the argument type of result() should be wrapped so that it's a
>const
>reference if it's larger than a pointer.

It may be best to simply pass all arguments types by const reference in
this instance. When instantiated then inlined the function call
overhead related to making temp-copy of the argument doesn't need to be
stripped away by the compiler during subsequent optimization, which can
make it easier for the compiler to identify that it is a good idea to
inline the function in the first place. There is no real draw back to
passing a built in type by const reference, particularly if your
intention is for the compiler to inline the function anyway.

Luke


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