| 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 <boost/phoenix.hpp> |
| 8 | |
| 9 | #include <boost/detail/lightweight_test.hpp> |
| 10 | |
| 11 | namespace phoenix = boost::phoenix; |
| 12 | using boost::phoenix::ref; |
| 13 | using namespace phoenix::local_names; |
| 14 | using boost::phoenix::arg_names::_1; |
| 15 | |
| 16 | int main(int argc, char *argv[]) |
| 17 | { |
| 18 | int x = 17; |
| 19 | int y = phoenix::lambda(_a=ref(t&: x)) |
| 20 | [ |
| 21 | _a = 18 |
| 22 | ]()(); |
| 23 | BOOST_TEST(y==18); |
| 24 | |
| 25 | int z = phoenix::lambda(_a=_1) |
| 26 | [ |
| 27 | _a = 18 |
| 28 | ](x)(); |
| 29 | std::cout << z << std::endl; |
| 30 | BOOST_TEST(y==18); |
| 31 | |
| 32 | return boost::report_errors(); |
| 33 | } |
| 34 |
