/*============================================================================= Copyright (c) 2005-2007 Dan Marsden Copyright (c) 2005-2007 Joel de Guzman Copyright (c) 2014-2015 John Fletcher Distributed under 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 namespace { void for_each_test() { using boost::phoenix::for_each; using boost::phoenix::lambda; using boost::phoenix::val; using boost::phoenix::arg_names::arg1; using boost::phoenix::arg_names::arg2; std::vector v; for (int i = 1; i < 10; i++) v.push_back(i); int x = 0; ( for_each(arg1, lambda[arg2 += arg1]) )(v,x); BOOST_TEST(x == 55); return; } } int main() { for_each_test(); boost::report_errors(); }