Boost logo

Boost :

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-24 04:08:38


On Thu, Jun 23, 2011 at 9:47 PM, Sebastian Karlsson <sairony_at_[hidden]> wrote:
> Seems to be easier than I anticipated, just add output type as a param
> and slap it in as the return type for transform_range_copy, like so:
>
>                template<typename SequenceT, typename OutputT >
>                inline SequenceT to_lower_copy(

Shouldn't the return type be OutputT?

>                        const SequenceT& Input,
>                        const std::locale& Loc=std::locale())
>                {
>                        return ::boost::algorithm::detail::transform_range_copy< OutputT >(
>                                Input,
>                                ::boost::algorithm::detail::to_lowerF<
>                                typename range_value<SequenceT>::type >(Loc));
>                }
>
> Seems to work with the little testing I've been able to do so far.

I'm not sure if C++ allows this, but SequenceT can be deduced while
OutputT can not.
Shouldn't OutputT therefore come first in the template list so that
SequenceT can be deduced?

Olaf


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