]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/phoenix/test/statement/if_tests.cpp
1 /*=============================================================================
2 Copyright (c) 2001-2007 Joel de Guzman
4 Distributed under the Boost Software License, Version 1.0. (See accompanying
5 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 ==============================================================================*/
10 #include <boost/detail/lightweight_test.hpp>
11 #include <boost/phoenix/core.hpp>
12 #include <boost/phoenix/statement.hpp>
13 #include <boost/phoenix/operator.hpp>
18 using boost::phoenix::arg_names::arg1
;
19 using boost::phoenix::if_
;
20 using boost::phoenix::ref
;
22 int init
[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
23 std::vector
<int> v(init
, init
+10);
25 std::cout
<< std::dec
;
28 for_each(v
.begin(), v
.end(),
29 if_(arg1
> 3 && arg1
<= 8)
31 std::cout
<< arg1
<< ", ",
36 std::cout
<< std::endl
;
37 BOOST_TEST(x
== 4+5+6+7+8);
43 for_each(v
.begin(), v
.end(),
46 std::cout
<< arg1
<< " > 5\n",
53 std::cout
<< arg1
<< " == 5\n",
58 std::cout
<< arg1
<< " < 5\n",
64 std::cout
<< std::endl
;
65 BOOST_TEST(x
== 6+7+8+9+10);
66 BOOST_TEST(y
== 1+2+3+4);
69 return boost::report_errors();