1 /*=============================================================================
2 Copyright (c) 2005-2010 Joel de Guzman
3 Copyright (c) 2010 Eric Niebler
4 Copyright (c) 2010 Thomas Heller
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
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>
21 namespace boost { namespace phoenix
25 template <typename Expr, typename Enable = void>
31 template <typename Rule, typename Dummy = void>
38 , proto::call<evaluator(proto::_, _context)>
44 template <typename Dummy>
45 struct is_nullary::when<rule::argument, Dummy>
47 BOOST_PROTO_TRANSFORM(is_nullary::when<rule::argument>)
48 template <typename Expr, typename State, typename Data>
51 typedef mpl::false_ result_type;
60 , bool IsTransform = proto::is_transform<Trait>::value
62 struct is_nullary_custom_terminal_impl
64 typedef typename Trait::type result_type;
67 template <typename Transform, typename Expr, typename State, typename Data>
68 struct is_nullary_custom_terminal_impl<Transform, Expr, State, Data, true>
71 typename Transform::template impl<
79 template <typename Dummy>
80 struct is_nullary::when<rule::custom_terminal, Dummy>
82 BOOST_PROTO_TRANSFORM(is_nullary::when<rule::custom_terminal>)
84 template <typename Expr, typename State, typename Data>
86 : is_nullary_custom_terminal_impl<
87 result_of::is_nullary<
89 typename proto::detail::uncvref<
90 typename proto::result_of::value<Expr>::type
94 , typename proto::result_of::value<Expr>::type
101 template <typename Dummy>
102 struct is_nullary::when<rule::terminal, Dummy>
104 BOOST_PROTO_TRANSFORM(is_nullary::when<rule::terminal>)
105 template <typename Expr, typename State, typename Data>
108 typedef mpl::true_ result_type;
114 template <typename Expr, typename Enable>
116 : boost::phoenix::evaluator::impl<
120 , boost::phoenix::is_nullary
126 template <typename T>
127 struct is_nullary<T & >
131 template <typename T>
132 struct is_nullary<T const & >
136 template <typename T>
137 struct is_nullary<T const >
141 template <typename T>
142 struct is_nullary<custom_terminal<T> >
146 template <typename T>
147 struct is_nullary<custom_terminal<actor<T> > >
151 template <typename T>
152 struct is_nullary<custom_terminal<boost::reference_wrapper<actor<T> > > >
154 BOOST_PROTO_TRANSFORM(is_nullary<custom_terminal<boost::reference_wrapper<actor<T> > > >)
155 template <typename Expr, typename State, typename Data>
158 typedef typename evaluator::template impl<actor<T>, State, Data>::result_type result_type;
162 template <typename T>
163 struct is_nullary<custom_terminal<boost::reference_wrapper<actor<T> const> > >
165 BOOST_PROTO_TRANSFORM(is_nullary<custom_terminal<boost::reference_wrapper<actor<T> const> > >)
166 template <typename Expr, typename State, typename Data>
169 typedef typename evaluator::template impl<actor<T> const, State, Data>::result_type result_type;