Boost logo

Boost :

From: Joel de Guzman (joel_at_[hidden])
Date: 2006-07-05 10:35:47

Gennaro Prota wrote:
> On Wed, 05 Jul 2006 22:01:55 +0800, Joel de Guzman
> <joel_at_[hidden]> wrote:
>> Me, I prefer the immutable and functional approach:
>> to_upper(to_lower(to_upper(rng)))
>> Yeah, for the record, I never liked the use of the |. With the
>> plain functional syntax, the joke is very clear.
> It could be a joke or a leftover from a previous example where the OP
> used three different things, such as to_upper, to_lower and trim, just
> to change them at the latest moment.
> But it might be not: the question of what the result of
> to_upper(to_lower(to_upper(rng))) is supposed to be is not trivial at
> all.

The result will be a view. Then, if it's done correctly, ideally,
the view transformations can collapse the view. IOTW, this:

     to_lower_view<to_upper_view<range> >

will be optimized to:



     to_upper_view<to_lower_view<range> >

will be optimized to:


Hence, the entire to_upper(to_lower(to_upper(rng))) will be
collapsed to:



Joel de Guzman

Boost list run by bdawes at, gregod at, cpdaniel at, john at