Boost logo

Boost :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2004-04-30 01:39:48


Thorsten Ottosen wrote:

> "Pavel Vozenilek" <pavel_vozenilek_at_[hidden]> wrote in message
> news:c6s7rh$fc9$1_at_sea.gmane.org...
> | I wonder whether Collection Traits can also use Filter Iterator
> | (http://www.boost.org/libs/iterator/doc/filter_iterator.html)
> | as 'collection'.
>
> nope. The requierement is that a default constructed iterator denotes the
> end.

I think it's possible to create iterator adaptor which makes default
constructed iterator denote the end. Hey, it's 10 mins effort, see

   http://zigzag.cs.msu.su:7813/implicit_eof_iterator

I'm not yet sure if this is better/worse than views, but definitely
Collection Traits need to have special support for Filter iterator. Either
we need views, or we need such wrapper iterator.

> | Or even whether it can simplify use of Filter Iterator a bit.
>
> I think the key for simpler use of all of the iterators in Boost.Iterator
> is to define
> special range versions of make_XX. I hope John and Matthew will do this in
> their range
> lib.

Where can I look at this lib, and how it's different/related to the views
library in the sandbox?

> For example
>
> make_filter_range( is_positive_number(), coll );
>
> Using Collection Traits that should be simple. So eventually we can write
>
> std::copy( boost::make_filter_range( is_positive_number(), numbers ),
> std::ostream_iterator<int>( std::cout, " " ) )

Yes, that's what I'd like. Only, I *really* think that the function should
be called just 'filter'. But that's just personal opinion.

- Volodya


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