diff --git a/minmax/example/minmax_timer.cpp b/minmax/example/minmax_timer.cpp index 0ab51a8..41aecfc 100644 --- a/minmax/example/minmax_timer.cpp +++ b/minmax/example/minmax_timer.cpp @@ -15,8 +15,10 @@ // What's the proper BOOST_ flag for vs #include -#include #include +#include +#include +#include template void tie(std::pair p, T1& min, T2& max) @@ -56,17 +58,19 @@ inline int opt_boost_minmax_count(int n) { int repeats = 10; #define TIMER( n, cmd , cmdname ) \ - t.restart(); \ - for (int i=0; i void test_minmax_element(CIterator first, CIterator last, int n, char* name) { typedef typename std::iterator_traits::value_type vtype; - boost::timer t; + boost::timer::cpu_timer t; std::cout << " ON " << name << " WITH OPERATOR<()\n"; TIMER( n, std::min_element(first, last), @@ -99,15 +103,11 @@ void test_minmax_element(CIterator first, CIterator last, int n, char* name) "boost::last_min_last_max_element" << name << " "); #define pred std::bind2nd( std::greater(), vtype(10) ) - TIMER( n, boost::min_element_if(first, last, pred), - "boost::min_element_if" << name << ""); - TIMER( n, boost::max_element_if(first, last, pred), - "boost::max_element_if" << name << ""); - TIMER( n, std::min_element(boost::make_filter_iterator(first, last, pred), - boost::make_filter_iterator(last, last, pred)), + TIMER( n, std::min_element(boost::make_filter_iterator(pred, first, last), + boost::make_filter_iterator(pred, last, last)), "std::min_element_with_filter_iterator" << name << ""); - TIMER( n, std::max_element(boost::make_filter_iterator(first, last, pred), - boost::make_filter_iterator(last, last, pred)), + TIMER( n, std::max_element(boost::make_filter_iterator(pred, first, last), + boost::make_filter_iterator(pred, last, last)), "std::max_element_if_with_filter_iterator" << name << ""); #undef pred @@ -199,10 +199,9 @@ void test(int n) test_range(first, last, n); } -int -main(char argc, char** argv) +int main(int argc, char** argv) { - int n = 100; + int n = 1000; if (argc > 1) n = atoi(argv[1]); if (argc > 2) repeats = atoi(argv[2]);