Ticket #8298: n8298.cpp

File n8298.cpp, 825 bytes (added by John Fletcher <J.P.Fletcher@…>, 9 years ago)

Working examples for bug report #8298

Line 
1/*=============================================================================
2 Copyright (c) 2014 John Fletcher
3 Distributed under the Boost Software License, Version 1.0. (See accompanying
4 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5==============================================================================*/
6
7#include <iostream>
8#include <boost/phoenix.hpp>
9
10namespace phoenix = boost::phoenix;
11using boost::phoenix::ref;
12using namespace phoenix::local_names;
13using boost::phoenix::arg_names::_1;
14
15int main(int argc, char *argv[])
16{
17 int x = 17;
18 int y = phoenix::lambda(_a=ref(x))
19 [
20 _a = 18
21 ]()();
22 std::cout << y << std::endl;
23
24 int z = phoenix::lambda(_a=_1)
25 [
26 _a = 18
27 ](x)();
28 std::cout << z << std::endl;
29
30 return 0;
31}
32