diff --git a/filter_iterator_example.cpp b/filter_iterator_example.cpp index 3346e70..ce96334 100644 --- a/filter_iterator_example.cpp +++ b/filter_iterator_example.cpp @@ -10,6 +10,7 @@ #include #include +#include #include #include @@ -22,7 +23,7 @@ int main() int numbers[] = { 0, -1, 4, -3, 5, 8, -2 }; const int N = sizeof(numbers)/sizeof(int); - // Example using make_filter_iterator + // Example using make_filter_iterator() std::copy(boost::make_filter_iterator(numbers, numbers + N), boost::make_filter_iterator(numbers + N, numbers + N), std::ostream_iterator(std::cout, " ")); @@ -37,6 +38,14 @@ int main() std::copy(filter_iter_first, filter_iter_last, std::ostream_iterator(std::cout, " ")); std::cout << std::endl; + + // Another example using make_filter_iterator() + std::copy(boost::make_filter_iterator(numbers, numbers + N, + std::bind2nd(std::greater(), -2)), + boost::make_filter_iterator(numbers + N, numbers + N, + std::bind2nd(std::greater(), -2)), + std::ostream_iterator(std::cout, " ")); + std::cout << std::endl; return 0;