Adaptation of boost::filter_iterator to allow an element to be selected multiple times. More...
#include <persistent_filter_iterator.hpp>
Public Member Functions | |
persistent_filter_iterator (Predicate f, Iterator x, Iterator end_=Iterator()) | |
persistent_filter_iterator (Iterator x, Iterator end_=Iterator()) | |
template<class OtherIterator > | |
persistent_filter_iterator (persistent_filter_iterator< Predicate, OtherIterator > const &t, typename boost::enable_if_convertible< OtherIterator, Iterator >::type *=0) | |
Predicate | predicate () const |
Iterator | end () const |
Friends | |
class | boost::iterator_core_access |
Adaptation of boost::filter_iterator to allow an element to be selected multiple times.
The class boost::filter_iterator is an example of boost::iterator_adaptor that allows iterating through a range, skipping elements that don't verify a predicate. In boost::filter_iterator, incrementing the iterator will always advance of at least one element. In persistent_filter_iterator, an incrementation will not advance to a next element until the predicate becomes false on the current element. This implies that the predicate has either some memory, or a pseudo-random behavior.
A persistent_filter_iterator thus iterates over a virtual range. Consequently, equality of two persistent_filter_iterator is only verified if they point to the same element in the original range and if their predicates are equal. Predicates must thus implement operator==
. To see whether two different persistent_filter_iterator actually point to the same input range element, one can compare the underlying iterators available through the base()
method.
The doc on boost::filter_iterator applies for this class, except for the small differences noted above.
Definition at line 30 of file persistent_filter_iterator.hpp.