1 /*=============================================================================
2 Phoenix V1.2.1
3 Copyright (c) 2001-2003 Joel de Guzman
4
5 Use, modification and distribution is subject to the Boost Software
6 License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
7 http://www.boost.org/LICENSE_1_0.txt)
8 ==============================================================================*/
9 #include <vector>
10 #include <algorithm>
11 #include <iostream>
12 #include <boost/spirit/include/phoenix1_operators.hpp>
13 #include <boost/spirit/include/phoenix1_primitives.hpp>
14 #include <boost/spirit/include/phoenix1_statements.hpp>
15 #include <boost/spirit/include/phoenix1_special_ops.hpp>
16
17 using namespace std;
18 using namespace phoenix;
19
20 int
main()21 main()
22 {
23 int init[] = { 2, 10, 4, 5, 1, 6, 8, 3, 9, 7 };
24 vector<int> c(init, init + 10);
25 typedef vector<int>::iterator iterator;
26
27 // Print all odd contents of an stl container c
28 for_each(c.begin(), c.end(),
29 if_(arg1 % 2 == 1)
30 [
31 cout << arg1 << ' '
32 ]
33 );
34
35 return 0;
36 }
37