File indexing completed on 2025-01-18 09:45:07
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef BOOST_PHOENIX_CORE_IS_NULLARY_HPP
0010 #define BOOST_PHOENIX_CORE_IS_NULLARY_HPP
0011
0012 #include <boost/phoenix/core/limits.hpp>
0013 #include <boost/phoenix/core/environment.hpp>
0014 #include <boost/phoenix/core/is_actor.hpp>
0015 #include <boost/phoenix/core/meta_grammar.hpp>
0016 #include <boost/phoenix/core/terminal_fwd.hpp>
0017 #include <boost/phoenix/support/vector.hpp>
0018 #include <boost/proto/transform/fold.hpp>
0019 #include <boost/proto/transform/lazy.hpp>
0020
0021 namespace boost { namespace phoenix
0022 {
0023 namespace result_of
0024 {
0025 template <typename Expr, typename Enable = void>
0026 struct is_nullary;
0027 }
0028
0029 struct is_nullary
0030 {
0031 template <typename Rule, typename Dummy = void>
0032 struct when
0033 : proto::fold<
0034 proto::_
0035 , mpl::true_()
0036 , mpl::and_<
0037 proto::_state
0038 , proto::call<evaluator(proto::_, _context)>
0039 >()
0040 >
0041 {};
0042 };
0043
0044 template <typename Dummy>
0045 struct is_nullary::when<rule::argument, Dummy>
0046 {
0047 BOOST_PROTO_TRANSFORM(is_nullary::when<rule::argument>)
0048 template <typename Expr, typename State, typename Data>
0049 struct impl
0050 {
0051 typedef mpl::false_ result_type;
0052 };
0053 };
0054
0055 template <
0056 typename Trait
0057 , typename Expr
0058 , typename State
0059 , typename Data
0060 , bool IsTransform = proto::is_transform<Trait>::value
0061 >
0062 struct is_nullary_custom_terminal_impl
0063 {
0064 typedef typename Trait::type result_type;
0065 };
0066
0067 template <typename Transform, typename Expr, typename State, typename Data>
0068 struct is_nullary_custom_terminal_impl<Transform, Expr, State, Data, true>
0069 {
0070 typedef
0071 typename Transform::template impl<
0072 Expr
0073 , State
0074 , Data
0075 >::result_type
0076 result_type;
0077 };
0078
0079 template <typename Dummy>
0080 struct is_nullary::when<rule::custom_terminal, Dummy>
0081 {
0082 BOOST_PROTO_TRANSFORM(is_nullary::when<rule::custom_terminal>)
0083
0084 template <typename Expr, typename State, typename Data>
0085 struct impl
0086 : is_nullary_custom_terminal_impl<
0087 result_of::is_nullary<
0088 custom_terminal<
0089 typename proto::detail::uncvref<
0090 typename proto::result_of::value<Expr>::type
0091 >::type
0092 >
0093 >
0094 , typename proto::result_of::value<Expr>::type
0095 , State
0096 , Data
0097 >
0098 {};
0099 };
0100
0101 template <typename Dummy>
0102 struct is_nullary::when<rule::terminal, Dummy>
0103 {
0104 BOOST_PROTO_TRANSFORM(is_nullary::when<rule::terminal>)
0105 template <typename Expr, typename State, typename Data>
0106 struct impl
0107 {
0108 typedef mpl::true_ result_type;
0109 };
0110 };
0111
0112 namespace result_of
0113 {
0114 template <typename Expr, typename Enable>
0115 struct is_nullary
0116 : boost::phoenix::evaluator::impl<
0117 Expr const &
0118 , vector2<
0119 mpl::true_
0120 , boost::phoenix::is_nullary
0121 >
0122 , proto::empty_env
0123 >::result_type
0124 {};
0125
0126 template <typename T>
0127 struct is_nullary<T & >
0128 : is_nullary<T>
0129 {};
0130
0131 template <typename T>
0132 struct is_nullary<T const & >
0133 : is_nullary<T>
0134 {};
0135
0136 template <typename T>
0137 struct is_nullary<T const >
0138 : is_nullary<T>
0139 {};
0140
0141 template <typename T>
0142 struct is_nullary<custom_terminal<T> >
0143 : mpl::true_
0144 {};
0145
0146 template <typename T>
0147 struct is_nullary<custom_terminal<actor<T> > >
0148 : evaluator
0149 {};
0150
0151 template <typename T>
0152 struct is_nullary<custom_terminal<boost::reference_wrapper<actor<T> > > >
0153 {
0154 BOOST_PROTO_TRANSFORM(is_nullary<custom_terminal<boost::reference_wrapper<actor<T> > > >)
0155 template <typename Expr, typename State, typename Data>
0156 struct impl
0157 {
0158 typedef typename evaluator::template impl<actor<T>, State, Data>::result_type result_type;
0159 };
0160 };
0161
0162 template <typename T>
0163 struct is_nullary<custom_terminal<boost::reference_wrapper<actor<T> const> > >
0164 {
0165 BOOST_PROTO_TRANSFORM(is_nullary<custom_terminal<boost::reference_wrapper<actor<T> const> > >)
0166 template <typename Expr, typename State, typename Data>
0167 struct impl
0168 {
0169 typedef typename evaluator::template impl<actor<T> const, State, Data>::result_type result_type;
0170 };
0171 };
0172 }
0173
0174 }}
0175
0176 #endif
0177