
2011/6/23 Olaf van der Spek <ml@vdspek.org>:
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
That appears to be truth, that's only a flaw in my implementation though, I'll see if I can fix it :) Kind regards, Sebastian Karlsson