• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*=============================================================================
2     Copyright (c) 2011 Thomas Heller
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 
8 #include <boost/phoenix.hpp>
9 #include <boost/typeof/typeof.hpp>
10 #include <iostream>
11 #include <vector>
12 #include <algorithm>
13 
main()14 int main()
15 {
16     using boost::phoenix::lambda;
17     using boost::phoenix::let;
18     using boost::phoenix::ref;
19     using boost::phoenix::construct;
20     using boost::phoenix::local_names::_a;
21     using boost::phoenix::arg_names::_1;
22 
23     BOOST_AUTO(
24        generator
25      , (lambda
26           (
27              _a = val(_1)
28           )
29         [
30            std::cout << _a << " "
31          , _a++
32         ] )
33        );
34 
35     int i = 0;
36     std::vector<int> v(10);
37     std::for_each(v.begin(), v.end(), generator(0));
38 }
39