]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/phoenix/test/scope/lambda_tests3.cpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / phoenix / test / scope / lambda_tests3.cpp
1 /*=============================================================================
2 Copyright (c) 2001-2007 Joel de Guzman
3 Copyright (c) 2014 John Fletcher
4
5 Distributed under the Boost Software License, Version 1.0. (See accompanying
6 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7 ==============================================================================*/
8 #include <iostream>
9 #include <cmath>
10 #include <algorithm>
11 #include <vector>
12
13 #include <typeinfo>
14
15 #include <boost/detail/lightweight_test.hpp>
16 #include <boost/phoenix/core.hpp>
17 #include <boost/phoenix/operator.hpp>
18 #include <boost/phoenix/function.hpp>
19 #include <boost/phoenix/bind.hpp>
20 #include <boost/phoenix/scope.hpp>
21
22 int
23 main()
24 {
25 using boost::phoenix::lambda;
26 using boost::phoenix::let;
27 using boost::phoenix::ref;
28 using boost::phoenix::val;
29 using boost::phoenix::arg_names::_1;
30 using boost::phoenix::arg_names::_2;
31 using boost::phoenix::local_names::_a;
32 using boost::phoenix::local_names::_b;
33 // using boost::phoenix::placeholders::arg1;
34
35
36 {
37 int x = 1, y = 10, z = 13;
38
39 BOOST_TEST(
40 lambda(_a = _1, _b = _2)
41 [
42 _1 + _a + _b
43 ]
44 (x, z)(y) == x + y + z
45 );
46 }
47
48 {
49 {
50 // $$$ Fixme. This should not be failing $$$
51 //int x = (let(_a = lambda[val(1)])[_a])()();
52 //BOOST_TEST(x == 1);
53 }
54
55 {
56 // int x = (let(_a = lambda[val(1)])[bind(_a)])();
57 // BOOST_TEST(x == 1);
58 // Take this out too, I am not sure about this.
59 }
60 }
61
62 {
63 int i = 0;
64 int j = 2;
65 BOOST_TEST(lambda[let(_a = _1)[_a = _2]]()(i, j) == j);
66 BOOST_TEST(i == j);
67 }
68
69
70 return boost::report_errors();
71 }