I am passed an Iterator and I have to pass it on to another function -- but filtered so that certain elements are skipped (it's a range of pointers, and I want to filter out the NULL pointers).
I googled for "stl filter iterator" to see how to do this, and boost::filter_iterator came up.
That looks nice and I could use it, but could I do that with the good old STL as well? Without copying the elements into a new container, of course.
I guess I'd have to create another iterator class that provides the necessary begin()
, end()
etc functions and does the filtering? So I'd exactly have to reimplement the boost
iterator_filter
...?