]>
Commit | Line | Data |
---|---|---|
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 | ||
22 | struct zzz {}; | |
23 | ||
24 | int | |
25 | main() | |
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 | { | |
54 | int x = 1, y = 10; | |
55 | BOOST_TEST( | |
56 | (_1 + lambda(_a = _1)[_a + _1 + 2])(x)(y) == 1+1+10+2 | |
57 | ); | |
58 | } | |
59 | ||
60 | { | |
61 | int x = 1, y = 10; | |
62 | BOOST_TEST( | |
63 | ( | |
64 | _1 + | |
65 | lambda(_a = _1) | |
66 | [ | |
67 | _a + lambda[_a + 2] | |
68 | ] | |
69 | ) | |
70 | (x)(y)(y) == 1+1+1+2 | |
71 | ); | |
72 | } | |
73 | */ | |
74 | return boost::report_errors(); | |
75 | } |