Boost logo

Boost :

From: John R. Bandela (jbandela_at_[hidden])
Date: 2003-07-01 19:34:33

I was playing with the new iterator adapters in the sandbox. As I was
looking at filter_iterator, I found that it allows user code to increment it
like a random access iterator. Here is an example that compiled on VC 7.1

#include <boost/iterator/filter_iterator.hpp>
#include <iterator>
#include <algorithm>
#include <iostream>

struct even
    bool operator()(int x) const
        return x%2 == 0;
int main( int argc, char* argv[] )
    int test[] = {1,2,3,4,5,6,7,8,9,10};

    typedef boost::filter_iterator<even,int*> filter_iter;

    filter_iter f(test,test+10);
    std::cout << "Correct filter results\n";

    std::cout << "\nIncorrect filter results\n";



Should filter_iterator use iterator_facade as its base instead of
iterator_adapter? It seems the iterator_adapter is incorrectly implementing


John Bandela

PS: I don't know if this is the place to ask, but I have updated tokenizer
to the new iterator adapters. Is there some place it should be placed
pending release of the new iterator_adapters?

Boost list run by bdawes at, gregod at, cpdaniel at, john at