Hi everyone,
I wanted to know if it was possible to have an iterator behaving like
both an indirect_iterator and a filter_iterator. I've tried to without
success.
Here is a minimal code that compiles but crashes.
=====================================
class CTest {
public:
CTest(int Value,int Id) : value(Value),id(Id) {};
int id;
int value;
};
std::vector vec;
vec.push_back(new CTest(4,7));
vec.push_back(new CTest(4,1));
//I want an iterator that I could use like iter->id / iter->value and
not (*iter)->id / (*iter)->value
struct SPredicate {
bool operator()( C& x) {
return (-1 < x.id);
}
};
typedef boost::filter_iterator FilterIterator;
FilteredIterator end(*vec.end());
for(FilteredIterator iter(*vec.begin());start != end; iter++){
std::cout << "id" << iter->id << "\tValue" << iter->m << std::endl;
}
=====================================
I'm new to boost and is very impressed by its possibilites. Hope I can
understand the code better later.
thanx
matt