
23 Jun
2011
23 Jun
'11
5:43 p.m.
On Thu, Jun 23, 2011 at 1:26 PM, Sebastian Karlsson <sairony@gmail.com> wrote:
OutputSequenceT Output( ::boost::begin( Input ), ::boost::end( Input ) );
Doesn't this also do an unnecessary copy?
Olaf
It does, but it uses one less which as stated is a prime candidate for NRVO. The current approach needs one temporary for the return value as well as a temporary for argument conversion, which is basically only there to inform about the return type.
OutputSequenceT Output( ::boost::begin( Input ), ::boost::end( Input ) ); This one copies input to output. Then the function does case conversion. The original (AFAIK) does the case conversion while copying from input to output. Olaf