• 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 <vector>
9 #include <algorithm>
10 #include <iostream>
11 #include <boost/phoenix.hpp>
12 
13 template <typename> struct wrap {};
14 
main()15 int main()
16 {
17     using boost::phoenix::val;
18     using boost::phoenix::lambda;
19     using boost::phoenix::let;
20     using boost::phoenix::construct;
21     using boost::phoenix::placeholders::_1;
22     using boost::phoenix::local_names::_a;
23 
24     int const n = 10;
25     std::vector<int> v1(n);
26 
27     let(_a = construct<int>(0))
28     [
29         generate(_1, lambda(_a = ref(_a))[_a++])
30       , std::cout << val("result:\n")
31       , for_each(_1, lambda[std::cout << _1 << ' '])
32       , std::cout << val('\n')
33     ](v1);
34 }
35