Advertisement
Guest User

Untitled

a guest
Apr 15th, 2014
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.75 KB | None | 0 0
  1. #include <boost/range/algorithm_ext/iota.hpp>
  2. #include <boost/range/algorithm/find.hpp>
  3. #include <boost/algorithm/cxx11/any_of.hpp>
  4. #include <boost/timer/timer.hpp>
  5.  
  6. int main()
  7. {
  8.     std::vector<int> foo(100000);
  9.     boost::iota(foo, 0);
  10.  
  11.     bool found_1, found_2, found_3;
  12.  
  13.     {
  14.         boost::timer::auto_cpu_timer timer;
  15.  
  16.         found_1 = (boost::find(foo, 49000) != foo.end());
  17.     }
  18.  
  19.     {
  20.         boost::timer::auto_cpu_timer timer;
  21.  
  22.         found_2 = boost::algorithm::any_of_equal(foo, 49000);
  23.     }
  24.  
  25.     {
  26.         boost::timer::auto_cpu_timer timer;
  27.  
  28.         found_3 = (std::find(foo.begin(), foo.end(), 49000) != foo.end());
  29.     }
  30.  
  31.  
  32.     std::cout << std::boolalpha << found_1 << '\n' << found_2 << '\n' << found_3 << '\n';
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement