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 |
|
---|
10 | namespace phoenix = boost::phoenix;
|
---|
11 | using boost::phoenix::ref;
|
---|
12 | using namespace phoenix::local_names;
|
---|
13 | using boost::phoenix::arg_names::_1;
|
---|
14 |
|
---|
15 | int 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 |
|
---|