Boost logo

Boost :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2001-07-26 05:53:42


On Thursday 26 July 2001 01:00, David Abrahams wrote:

> > In fact, you don't need a "range interface", which I assume means a pair
>
> of
>
> > iterators, to separate enumeration from containment. A single object is
> > sufficient for describing a range.
>
> And there is a boost/half_open_range.hpp file which has been in-progress
> for some time in your latest boost release. If someone would like to take
> up the job of finishing it, I'm sure it would be widely appreciated.

What needs to be done with it?

> > As related issue, it is possible to write functions that return an object
>
> that
>
> > has a container-like interface (has begin() and end()), but refers to the
> > elements of the container differently. In particular, I'm thinking about
>
> the
>
> > functions 'drop', 'take' and 'filter' (but there are many more, such as
>
> 'rev')
>
> > that you can find in many functional languages.
>
> Yes, see also the View Template Library (VTL) http://www.zib.de/weiser/vtl/

Indeed, better support for functional programming and for views in
particualar is very important motivation for algorithms working on
containers. sort(v) vs. sort(v.begin(), v.end()) might not be considered a
significant improvement by some people, but look at this code:
size_t unroll_factor = *max_element(transview(lrs_span,
                        member(*this, &RegisterAllocator::unroll_factor)));
Without container algorithms it will be *desperately* tedious to write and
read, and, in general, slowdown is also possible.

-- 
Regards,
Vladimir

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