Subject: Re: [boost] [algorithm] to_lower_copy / to_upper_copy with no output param assumes sequence to be same as input
From: Olaf van der Spek (ml_at_[hidden])
Date: 2011-06-23 13:43:31


On Thu, Jun 23, 2011 at 1:26 PM, Sebastian Karlsson <sairony_at_[hidden]> 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