]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/phoenix/example/find_if.cpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / phoenix / example / find_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 <vector>
8 #include <algorithm>
9 #include <iostream>
10 #include <boost/phoenix/core.hpp>
11 #include <boost/phoenix/operator.hpp>
12
13 int
14 main()
15 {
16 using boost::phoenix::arg_names::arg1;
17
18 int init[] = { 2, 10, 4, 5, 1, 6, 8, 3, 9, 7 };
19 std::vector<int> c(init, init + 10);
20 typedef std::vector<int>::iterator iterator;
21
22 // Find the first odd number in container c
23 iterator it = std::find_if(c.begin(), c.end(), arg1 % 2 == 1);
24
25 if (it != c.end())
26 std::cout << *it << std::endl; // if found, print the result
27 return 0;
28 }