Boost logo

Boost :

From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2008-04-01 12:23:32


AMDG

Andrey Semashev wrote:
> Hi,
>
> I propose to add a simple helper function to create an iterator range
> of boost::transform_iterators. This would effectively create a view
> over a different range or a container.
>
> Currently this is possible to do with considerable code duplication:
>
> make_iterator_range(
> make_transform_iterator(vec.begin(), fun),
> make_transform_iterator(vec.end(), fun));
>
> Here "fun" could be a rather complex lambda or bind expression. What I
> propose is to wrap these calls into a simple generator make_view. The
> above code would look much better:
>
> make_view(vec.begin(), vec.end(), fun);
>
> or
>
> make_view(vec, fun);
>
> I've attached a sample implementation of the make_view function. Do
> you think this could be useful?

I want this utility on a regular basis.

In Christ,
Steven Watanabe


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