|
Boost : |
From: Thorsten Ottosen (nesotto_at_[hidden])
Date: 2004-04-29 21:10:48
"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.
| 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. 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, " " ) )
instead of
std::copy(boost::make_filter_iterator<is_positive_number>(numbers, numbers
+ N),
boost::make_filter_iterator<is_positive_number>(numbers +
N, numbers + N),
std::ostream_iterator<int>(std::cout, " "));
Ans similar for other iterators.
br
Thorsten
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk