]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/phoenix/example/if.cpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / phoenix / example / if.cpp
1 /*=============================================================================
2 Copyright (c) 2001-2007 Joel de Guzman
3
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 ==============================================================================*/
7 #include <iostream>
8 #include <vector>
9 #include <algorithm>
10 #include <boost/phoenix/statement.hpp>
11 #include <boost/phoenix/operator.hpp>
12 #include <boost/phoenix/core.hpp>
13
14 int
15 main()
16 {
17 using boost::phoenix::if_;
18 using boost::phoenix::arg_names::arg1;
19
20 int init[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
21 std::vector<int> v(init, init+10);
22
23 std::cout << std::dec;
24 int x = 0;
25
26 std::for_each(v.begin(), v.end(),
27 if_(arg1 > 5)
28 [
29 std::cout << arg1 << ", "
30 ]
31 );
32
33 std::cout << std::endl;
34
35 return 0;
36 }