
Hi, I don't see a reason for filter_iterator not to work with map iterators. However, the program below doesn't work. I get a compiler error "Cannot generate template specialization from 'make_filter_iterator<Predicate,Iterator> (Iterator,Iterator,const Predicate &)' in function main()" Any ideas? Thanks, Rodrigo #include <map> #include <ostream> #include "boost/iterator_adaptors.hpp" #include <algorithm> using namespace std; using namespace boost; struct pair_is_active { bool operator()(const pair<const size_t,float>& p) { return 0 < p.second; } }; ostream& operator<<(ostream& o, pair<const size_t, float> p) { return o << "(" << p.first << ", " << p.second << ")"; } int main() { map<size_t,float> m; m[0] = 10; m[1] = 15; m[2] = 0; m[3] = 13; copy(boost::make_filter_iterator<pair_is_active>(m.begin, m.end()), boost::make_filter_iterator<pair_is_active>(m.end(), m.end()), ostream_iterator<pair<const size_t,float> >(cout,",")); return 0; }