|
Boost Users : |
From: David Abrahams (dave_at_[hidden])
Date: 2005-03-22 17:44:56
steve ahlgren <steveahlgren_at_[hidden]> writes:
> Hello all :
>
> I have a filter_iterator question.
>
> I'm wondering if, conceptualy, I can construct an FI doing something
> like the following :
>
> typedef boost::filter_iterator< boost::bind( boost::mem_fn(
> &MyObject::HasQuality ), boost::ref( quality ) ), MyIterator >
> FilteredIterator;
You don't need mem_fn; bind will handle that implicitly.
But sure, that'll work in principle. Just not in practice ;-). The
problem is that you're putting a runtime expression in the template
where a type is supposed to be. On the other hand, you could use
make_filter_iterator to generate an appropriate iterator object.
http://www.boost.org/libs/iterator/doc/filter_iterator.html#filter-iterator-operations
-- Dave Abrahams Boost Consulting www.boost-consulting.com
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net