
Gennaro Prota wrote:
On Wed, 05 Jul 2006 22:01:55 +0800, Joel de Guzman <joel@boost-consulting.com> 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_lower_view<range> and: to_upper_view<to_lower_view<range> > will be optimized to: to_upper_view<range> Hence, the entire to_upper(to_lower(to_upper(rng))) will be collapsed to: to_upper(rng) Regards, -- Joel de Guzman http://www.boost-consulting.com http://spirit.sf.net