Not a member of Pastebin yet?
                        Sign Up,
                        it unlocks many cool features!                    
                - #include <boost/range/algorithm_ext/iota.hpp>
 - #include <boost/range/algorithm/find.hpp>
 - #include <boost/algorithm/cxx11/any_of.hpp>
 - #include <boost/timer/timer.hpp>
 - int main()
 - {
 - std::vector<int> foo(100000);
 - boost::iota(foo, 0);
 - bool found_1, found_2, found_3;
 - {
 - boost::timer::auto_cpu_timer timer;
 - found_1 = (boost::find(foo, 49) != foo.end());
 - }
 - {
 - boost::timer::auto_cpu_timer timer;
 - found_2 = boost::algorithm::any_of_equal(foo, 49000);
 - }
 - {
 - boost::timer::auto_cpu_timer timer;
 - found_3 = (std::find(foo.begin(), foo.end(), 49) != foo.end());
 - }
 - std::cout << std::boolalpha << found_1 << '\n' << found_2 << '\n' << found_3 << '\n';
 - }
 
Advertisement
 
                    Add Comment                
                
                        Please, Sign In to add comment