// (C) Copyright 2008-2009 SDML (www.sdml.info) // // Use, modification and distribution is subject to the Boost Software // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #include #include #include #include #include #include #include #include using namespace origin; using std::cout; struct foo { }; bool is_zero(int x) { return x == 0; } struct is_zero_f { bool operator()(int x) const { return x == 0; } }; void func1() { } int main() { typedef std::vector Vector; typedef std::list List; Vector v = { 0 }, w(1); List l = { 0 }; BOOST_ASSERT(origin::find(v.begin(), v.end(), 0) == v.begin()); BOOST_ASSERT(origin::find(l.begin(), l.end(), 0) == l.begin()); // find(foo(), foo(), 0); BOOST_ASSERT(origin::find_if(v.begin(), v.end(), is_zero) == v.begin()); BOOST_ASSERT(origin::find_if(v.begin(), v.end(), is_zero_f()) == v.begin()); // BOOST_ASSERT(find_if(v.begin(), v.end(), func1) == v.begin()); OK BOOST_ASSERT(( origin::all_of(v.begin(), v.end(), is_zero) )); BOOST_ASSERT(( origin::any_of(v.begin(), v.end(), is_zero) )); BOOST_ASSERT(( !origin::none_of(v.begin(), v.end(), is_zero) )); BOOST_ASSERT(( origin::copy(v.begin(), v.end(), w.begin()) == w.end() )); BOOST_ASSERT(( origin::copy_n(v.begin(), 1, w.begin()) == w.end() )); BOOST_ASSERT(( origin::copy_if(v.begin(), v.end(), w.begin(), is_zero) == w.end() )); return 0; }