]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/phoenix/core/is_nullary.hpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / boost / phoenix / core / is_nullary.hpp
1 /*=============================================================================
2 Copyright (c) 2005-2010 Joel de Guzman
3 Copyright (c) 2010 Eric Niebler
4 Copyright (c) 2010 Thomas Heller
5
6 Distributed under the Boost Software License, Version 1.0. (See accompanying
7 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
8 ==============================================================================*/
9 #ifndef BOOST_PHOENIX_CORE_IS_NULLARY_HPP
10 #define BOOST_PHOENIX_CORE_IS_NULLARY_HPP
11
12 #include <boost/phoenix/core/limits.hpp>
13 #include <boost/phoenix/core/environment.hpp>
14 #include <boost/phoenix/core/is_actor.hpp>
15 #include <boost/phoenix/core/meta_grammar.hpp>
16 #include <boost/phoenix/core/terminal_fwd.hpp>
17 #include <boost/phoenix/support/vector.hpp>
18 #include <boost/proto/transform/fold.hpp>
19 #include <boost/proto/transform/lazy.hpp>
20
21 namespace boost { namespace phoenix
22 {
23 namespace result_of
24 {
25 template <typename Expr, typename Enable = void>
26 struct is_nullary;
27 }
28
29 struct is_nullary
30 {
31 template <typename Rule, typename Dummy = void>
32 struct when
33 : proto::fold<
34 proto::_
35 , mpl::true_()
36 , mpl::and_<
37 proto::_state
38 , proto::call<evaluator(proto::_, _context)>
39 >()
40 >
41 {};
42 };
43
44 template <typename Dummy>
45 struct is_nullary::when<rule::argument, Dummy>
46 {
47 BOOST_PROTO_TRANSFORM(is_nullary::when<rule::argument>)
48 template <typename Expr, typename State, typename Data>
49 struct impl
50 {
51 typedef mpl::false_ result_type;
52 };
53 };
54
55 template <
56 typename Trait
57 , typename Expr
58 , typename State
59 , typename Data
60 , bool IsTransform = proto::is_transform<Trait>::value
61 >
62 struct is_nullary_custom_terminal_impl
63 {
64 typedef typename Trait::type result_type;
65 };
66
67 template <typename Transform, typename Expr, typename State, typename Data>
68 struct is_nullary_custom_terminal_impl<Transform, Expr, State, Data, true>
69 {
70 typedef
71 typename Transform::template impl<
72 Expr
73 , State
74 , Data
75 >::result_type
76 result_type;
77 };
78
79 template <typename Dummy>
80 struct is_nullary::when<rule::custom_terminal, Dummy>
81 {
82 BOOST_PROTO_TRANSFORM(is_nullary::when<rule::custom_terminal>)
83
84 template <typename Expr, typename State, typename Data>
85 struct impl
86 : is_nullary_custom_terminal_impl<
87 result_of::is_nullary<
88 custom_terminal<
89 typename proto::detail::uncvref<
90 typename proto::result_of::value<Expr>::type
91 >::type
92 >
93 >
94 , typename proto::result_of::value<Expr>::type
95 , State
96 , Data
97 >
98 {};
99 };
100
101 template <typename Dummy>
102 struct is_nullary::when<rule::terminal, Dummy>
103 {
104 BOOST_PROTO_TRANSFORM(is_nullary::when<rule::terminal>)
105 template <typename Expr, typename State, typename Data>
106 struct impl
107 {
108 typedef mpl::true_ result_type;
109 };
110 };
111
112 namespace result_of
113 {
114 template <typename Expr, typename Enable>
115 struct is_nullary
116 : boost::phoenix::evaluator::impl<
117 Expr const &
118 , vector2<
119 mpl::true_
120 , boost::phoenix::is_nullary
121 >
122 , proto::empty_env
123 >::result_type
124 {};
125
126 template <typename T>
127 struct is_nullary<T & >
128 : is_nullary<T>
129 {};
130
131 template <typename T>
132 struct is_nullary<T const & >
133 : is_nullary<T>
134 {};
135
136 template <typename T>
137 struct is_nullary<T const >
138 : is_nullary<T>
139 {};
140
141 template <typename T>
142 struct is_nullary<custom_terminal<T> >
143 : mpl::true_
144 {};
145
146 template <typename T>
147 struct is_nullary<custom_terminal<actor<T> > >
148 : evaluator
149 {};
150
151 template <typename T>
152 struct is_nullary<custom_terminal<boost::reference_wrapper<actor<T> > > >
153 {
154 BOOST_PROTO_TRANSFORM(is_nullary<custom_terminal<boost::reference_wrapper<actor<T> > > >)
155 template <typename Expr, typename State, typename Data>
156 struct impl
157 {
158 typedef typename evaluator::template impl<actor<T>, State, Data>::result_type result_type;
159 };
160 };
161
162 template <typename T>
163 struct is_nullary<custom_terminal<boost::reference_wrapper<actor<T> const> > >
164 {
165 BOOST_PROTO_TRANSFORM(is_nullary<custom_terminal<boost::reference_wrapper<actor<T> const> > >)
166 template <typename Expr, typename State, typename Data>
167 struct impl
168 {
169 typedef typename evaluator::template impl<actor<T> const, State, Data>::result_type result_type;
170 };
171 };
172 }
173
174 }}
175
176 #endif
177