]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/phoenix/include/boost/phoenix/operator/detail/define_operator.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / phoenix / include / boost / phoenix / operator / detail / define_operator.hpp
1 /*==============================================================================
2 Copyright (c) 2005-2010 Joel de Guzman
3 Copyright (c) 2010 Thomas Heller
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
9 #ifndef BOOST_PHOENIX_DEFINE_OPERATOR_HPP
10 #define BOOST_PHOENIX_DEFINE_OPERATOR_HPP
11
12 #include <boost/phoenix/core/meta_grammar.hpp>
13 #include <boost/preprocessor/seq/for_each.hpp>
14
15 #define BOOST_PHOENIX_UNARY_EXPRESSION(__, ___, name) \
16 template <typename Operand> \
17 struct name \
18 : expr<proto::tag::name, Operand> \
19 {}; \
20 /**/
21
22 #define BOOST_PHOENIX_UNARY_RULE(__, ___, name) \
23 struct name \
24 : expression::name<meta_grammar> \
25 {}; \
26 /**/
27
28 #define BOOST_PHOENIX_UNARY_FUNCTIONAL(__, ___, name) \
29 namespace functional \
30 { \
31 typedef \
32 proto::functional::make_expr<proto::tag::name> \
33 BOOST_PP_CAT(make_, name); \
34 } \
35 namespace result_of \
36 { \
37 template <typename Operand> \
38 struct BOOST_PP_CAT(make_, name) \
39 : boost::result_of< \
40 functional:: BOOST_PP_CAT(make_, name)( \
41 Operand \
42 ) \
43 > \
44 {}; \
45 } \
46 template <typename Operand> \
47 inline \
48 typename result_of::BOOST_PP_CAT(make_, name)<Operand>::type \
49 BOOST_PP_CAT(make_, name)(Operand const & operand) \
50 { \
51 return functional::BOOST_PP_CAT(make_, name)()(operand); \
52 } \
53 /**/
54
55 #define BOOST_PHOENIX_BINARY_EXPRESSION(__, ___, name) \
56 template <typename Lhs, typename Rhs> \
57 struct name \
58 : expr<proto::tag::name, Lhs, Rhs> \
59 {}; \
60 /**/
61
62 #define BOOST_PHOENIX_BINARY_RULE(__, ___, name) \
63 struct name \
64 : expression::name<meta_grammar, meta_grammar> \
65 {}; \
66 /**/
67
68 #define BOOST_PHOENIX_BINARY_FUNCTIONAL(__, ___, name) \
69 namespace functional \
70 { \
71 typedef \
72 proto::functional::make_expr<proto::tag::name> \
73 BOOST_PP_CAT(make_, name); \
74 } \
75 namespace result_of \
76 { \
77 template <typename Lhs, typename Rhs> \
78 struct BOOST_PP_CAT(make_, name) \
79 : boost::result_of< \
80 functional:: BOOST_PP_CAT(make_, name)( \
81 Lhs, Rhs \
82 ) \
83 > \
84 {}; \
85 } \
86 template <typename Rhs, typename Lhs> \
87 inline \
88 typename result_of::BOOST_PP_CAT(make_, name)<Rhs, Lhs>::type \
89 BOOST_PP_CAT(make_, name)(Lhs const & lhs, Rhs const & rhs) \
90 { \
91 return functional::BOOST_PP_CAT(make_, name)()(lhs, rhs); \
92 } \
93 /**/
94
95 #define BOOST_PHOENIX_GRAMMAR(_, __, name) \
96 template <typename Dummy> \
97 struct meta_grammar::case_<proto::tag::name, Dummy> \
98 : enable_rule<rule::name, Dummy> \
99 {}; \
100 /**/
101
102 #define BOOST_PHOENIX_UNARY_OPERATORS(ops) \
103 namespace expression { \
104 BOOST_PP_SEQ_FOR_EACH(BOOST_PHOENIX_UNARY_EXPRESSION, _, ops) \
105 } \
106 namespace rule { \
107 BOOST_PP_SEQ_FOR_EACH(BOOST_PHOENIX_UNARY_RULE, _, ops) \
108 } \
109 BOOST_PP_SEQ_FOR_EACH(BOOST_PHOENIX_GRAMMAR, _, ops) \
110 BOOST_PP_SEQ_FOR_EACH(BOOST_PHOENIX_UNARY_FUNCTIONAL, _, ops) \
111 /**/
112
113
114 #define BOOST_PHOENIX_BINARY_OPERATORS(ops) \
115 namespace expression { \
116 BOOST_PP_SEQ_FOR_EACH(BOOST_PHOENIX_BINARY_EXPRESSION, _, ops) \
117 } \
118 namespace rule { \
119 BOOST_PP_SEQ_FOR_EACH(BOOST_PHOENIX_BINARY_RULE, _, ops) \
120 } \
121 BOOST_PP_SEQ_FOR_EACH(BOOST_PHOENIX_GRAMMAR, _, ops) \
122 BOOST_PP_SEQ_FOR_EACH(BOOST_PHOENIX_BINARY_FUNCTIONAL, _, ops) \
123 /**/
124
125 #endif