• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
15 using namespace std;
16 using namespace phoenix;
17 
18 int
main()19 main()
20 {
21     int init[] = { 2, 10, 4, 5, 1, 6, 8, 3, 9, 7 };
22     vector<int> c(init, init + 10);
23     typedef vector<int>::iterator iterator;
24 
25     //  Find the first odd number in container c
26     iterator it = find_if(c.begin(), c.end(), arg1 % 2 == 1);
27 
28     if (it != c.end())
29         cout << *it;    //  if found, print the result
30     return 0;
31 }
32