
Jody Hagins wrote:
On Wed, 05 Jul 2006 22:35:47 +0800 Joel de Guzman <joel@boost-consulting.com> wrote:
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)
That's a whole bunch of assumptions, both on the compiler and the developer, not to mention the semantics of each "view." I've used views on numerous occasions, and while they give the appearance of "no cost" they do, quite often, incur significant overhead. Both for the view abstraction itself, and the shenanigans behind the scene when the real underlying data changes.
Hey, they are great for some things, but I do not see how they can be the endall that eliminates mutable interfaces...
Maybe. But unless you provide some benchmarks and numbers, what you are hinting at has no weight, as far as I'm concerned. Regards, -- Joel de Guzman http://www.boost-consulting.com http://spirit.sf.net