Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/libs/spirit/phoenix/example/fundamental/sample2.cpp @ 29

Last change on this file since 29 was 29, checked in by landauf, 16 years ago

updated boost from 1_33_1 to 1_34_1

File size: 966 bytes
Line 
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/phoenix/operators.hpp>
13#include <boost/spirit/phoenix/primitives.hpp>
14
15using namespace std;
16using namespace phoenix;
17
18int
19main()
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}
Note: See TracBrowser for help on using the repository browser.