| ||||||||||||||||||||||||||||||||
tlp::StlFilterIterator< VALUE, ITERATOR, FILTER > Class Template Reference Iterator that enables to filter a Stl Iterator. More...
Inheritance diagram for tlp::StlFilterIterator< VALUE, ITERATOR, FILTER >:
![]()
Collaboration diagram for tlp::StlFilterIterator< VALUE, ITERATOR, FILTER >:
![]() Public Member Functions
Detailed Descriptiontemplate<typename VALUE, typename ITERATOR, typename FILTER>
|
startIt | the beginning of the iterator that should be filtered (begin()) |
endIt | the end of the iterator that should be filtered (begin()) |
filter | the functor that enables to test wheter or not an element is filtered |
That example enable to iterate only of elements greater than 50;
class GreaterFilter { GreaterFilter(double threshold):_t(threshold){ } bool operator()(double a) { return a < _t; } }; int main() { vector<double> vec(100); for (size_t j=0; j<100; ++j) vec[j] = j; GreaterFilter filter(50); double x; forEach(x, new StlFilterIterator<double, vector<double>::const_iterator>(vec.begin(), vec.end(), filter)) { cout << x << endl; }
tlp::StlFilterIterator< VALUE, ITERATOR, FILTER >::StlFilterIterator | ( | const ITERATOR & | startIt, |
const ITERATOR & | endIt, | ||
FILTER | filter | ||
) | [inline] |
bool tlp::StlFilterIterator< VALUE, ITERATOR, FILTER >::hasNext | ( | ) | [inline, virtual] |
Tells if the sequence is at its end.
Implements tlp::Iterator< VALUE >.
VALUE tlp::StlFilterIterator< VALUE, ITERATOR, FILTER >::next | ( | ) | [inline, virtual] |
Moves the Iterator on the next element.
Implements tlp::Iterator< VALUE >.
Tulip Software by LaBRI Visualization Team 2001 - 2012 |