From: John Maddock (John_Maddock_at_[hidden])
Date: 2001-02-18 06:47:18
>I have noticed that the call_traits<>::const_reference translates to
>const& even for 'small built-in types' I was wondering if it wouldn't
>be "better" i.e more efficient to let it translate to const by-value
>for these types instead?
>The only reason I can think of Not to do this, is to make a const_cast
>work, but as I understand the standard doesn't require a const_cast
>to succeed at all?
No, the members const_reference and reference are always guarenteed to be
references - they are intended for things like return values etc. Although
thinking about it, maybe a value might be better in those cases... although
I doubt it makes any difference in practice. IMO the *only* curcumstances
in which call_traits performs a real optimisation, is when the "optimised"
parameter passed is subject to an alias retated optimisation problem. I
don't think that can occur for return values...
- John Maddock
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk