]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/phoenix/test/scope/lambda_tests1b2q.cpp
bump version to 12.2.12-pve1
[ceph.git] / ceph / src / boost / libs / phoenix / test / scope / lambda_tests1b2q.cpp
CommitLineData
7c673cae
FG
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
22struct zzz {};
23
24int
25main()
26{
27 using boost::phoenix::lambda;
28 using boost::phoenix::let;
29 using boost::phoenix::ref;
30 using boost::phoenix::val;
31 using boost::phoenix::arg_names::_1;
32 //using boost::phoenix::arg_names::_2;
33 using boost::phoenix::local_names::_a;
34 //using boost::phoenix::local_names::_b;
35 // using boost::phoenix::placeholders::arg1;
36
37 /*
38 {
39 int x = 1;
40 long x2 = 2;
41 short x3 = 3;
42 char const* y = "hello";
43 zzz z;
44
45 BOOST_TEST(lambda[_1](x)(y) == y);
46 BOOST_TEST(lambda(_a = _1)[_a](x)(y) == x);
47 BOOST_TEST(lambda(_a = _1)[lambda[_a]](x)(y)(z) == x);
48 BOOST_TEST(lambda(_a = _1)[lambda[_a + _1]](x)(y)(x) == 2);
49 BOOST_TEST(lambda(_a = _1)[lambda(_b = _1)[_a + _b + _1]](x)(x2)(x3) == 6);
50 }
51 */
52 {
53 int x = 1, y = 10;
54 BOOST_TEST(
55 (_1 + lambda(_a = _1)[_a + _1 + 2])(x)(y) == 1+1+10+2
56 );
57 }
58 /*
59 {
60 int x = 1, y = 10;
61 BOOST_TEST(
62 (
63 _1 +
64 lambda(_a = _1)
65 [
66 _a + lambda[_a + 2]
67 ]
68 )
69 (x)(y)(y) == 1+1+1+2
70 );
71 }
72 */
73 return boost::report_errors();
74}