|
Boost : |
From: Jody Hagins (jody-boost-011304_at_[hidden])
Date: 2006-07-05 13:17:07
On Wed, 05 Jul 2006 22:35:47 +0800
Joel de Guzman <joel_at_[hidden]> 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...
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk