]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/phoenix/test/scope/lambda_tests1b1r.cpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / phoenix / test / scope / lambda_tests1b1r.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 // Test of workaround for MSVC 12 and 14
16 #include <boost/config.hpp>
17 #if defined(BOOST_MSVC) && (BOOST_MSVC >= 1700)
18 #define BOOST_RESULT_OF_USE_TR1
19 #endif
20
21 #include <boost/detail/lightweight_test.hpp>
22 #include <boost/phoenix/core.hpp>
23 #include <boost/phoenix/operator.hpp>
24 #include <boost/phoenix/function.hpp>
25 //#include <boost/phoenix/bind.hpp>
26 #include <boost/phoenix/scope.hpp>
27
28 struct zzz {};
29
30 int
31 main()
32 {
33 using boost::phoenix::lambda;
34 using boost::phoenix::let;
35 using boost::phoenix::ref;
36 using boost::phoenix::val;
37 using boost::phoenix::arg_names::_1;
38 //using boost::phoenix::arg_names::_2;
39 using boost::phoenix::local_names::_a;
40 //using boost::phoenix::local_names::_b;
41 // using boost::phoenix::placeholders::arg1;
42
43
44 {
45 int x = 1;
46 //long x2 = 2;
47 //short x3 = 3;
48 char const* y = "hello";
49 zzz z;
50 //BOOST_TEST(lambda[_1](x)(y) == y);
51 //BOOST_TEST(lambda(_a = _1)[_a](x)(y) == x);
52 #if defined(BOOST_MSVC) && (BOOST_MSVC >= 1700)
53 int xx = 20;
54 BOOST_TEST(lambda(_a = _1)[lambda[_a]](x)(y)(xx) == x);
55 #else
56 BOOST_TEST(lambda(_a = _1)[lambda[_a]](x)(y)(z) == x);
57 #endif
58 //BOOST_TEST(lambda(_a = _1)[lambda[_a + _1]](x)(y)(x) == 2);
59 //BOOST_TEST(lambda(_a = _1)[lambda(_b = _1)[_a + _b + _1]](x)(x2)(x3) == 6);
60 }
61
62 /*
63 {
64 int x = 1, y = 10;
65 BOOST_TEST(
66 (_1 + lambda(_a = _1)[_a + _1 + 2])(x)(y) == 1+1+10+2
67 );
68 }
69
70 {
71 int x = 1, y = 10;
72 BOOST_TEST(
73 (
74 _1 +
75 lambda(_a = _1)
76 [
77 _a + lambda[_a + 2]
78 ]
79 )
80 (x)(y)(y) == 1+1+1+2
81 );
82 }
83 */
84 return boost::report_errors();
85 }