File indexing completed on 2025-01-18 09:50:32
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef BOOST_PROTO_EVAL_HPP_EAN_03_29_2007
0010 #define BOOST_PROTO_EVAL_HPP_EAN_03_29_2007
0011
0012 #include <boost/proto/proto_fwd.hpp> // BOOST_PROTO_CALLABLE
0013 #include <boost/type_traits/remove_reference.hpp>
0014
0015 namespace boost { namespace proto
0016 {
0017
0018 namespace result_of
0019 {
0020
0021
0022
0023
0024
0025
0026
0027 template<typename Expr, typename Context>
0028 struct eval
0029 {
0030 typedef typename Context::template eval<Expr>::result_type type;
0031 };
0032 }
0033
0034 namespace functional
0035 {
0036
0037
0038
0039 struct eval
0040 {
0041 BOOST_PROTO_CALLABLE()
0042
0043 template<typename Sig>
0044 struct result;
0045
0046 template<typename This, typename Expr, typename Context>
0047 struct result<This(Expr, Context)>
0048 {
0049 typedef
0050 typename proto::result_of::eval<
0051 typename remove_reference<Expr>::type
0052 , typename remove_reference<Context>::type
0053 >::type
0054 type;
0055 };
0056
0057
0058
0059
0060
0061
0062
0063 template<typename Expr, typename Context>
0064 typename proto::result_of::eval<Expr, Context>::type
0065 operator ()(Expr &e, Context &ctx) const
0066 {
0067 return typename Context::template eval<Expr>()(e, ctx);
0068 }
0069
0070
0071
0072 template<typename Expr, typename Context>
0073 typename proto::result_of::eval<Expr, Context>::type
0074 operator ()(Expr &e, Context const &ctx) const
0075 {
0076 return typename Context::template eval<Expr>()(e, ctx);
0077 }
0078
0079
0080
0081 template<typename Expr, typename Context>
0082 typename proto::result_of::eval<Expr const, Context>::type
0083 operator ()(Expr const &e, Context &ctx) const
0084 {
0085 return typename Context::template eval<Expr const>()(e, ctx);
0086 }
0087
0088
0089
0090 template<typename Expr, typename Context>
0091 typename proto::result_of::eval<Expr const, Context>::type
0092 operator ()(Expr const &e, Context const &ctx) const
0093 {
0094 return typename Context::template eval<Expr const>()(e, ctx);
0095 }
0096 };
0097 }
0098
0099
0100
0101
0102
0103
0104
0105 template<typename Expr, typename Context>
0106 typename proto::result_of::eval<Expr, Context>::type
0107 eval(Expr &e, Context &ctx)
0108 {
0109 return typename Context::template eval<Expr>()(e, ctx);
0110 }
0111
0112
0113
0114 template<typename Expr, typename Context>
0115 typename proto::result_of::eval<Expr, Context>::type
0116 eval(Expr &e, Context const &ctx)
0117 {
0118 return typename Context::template eval<Expr>()(e, ctx);
0119 }
0120
0121
0122
0123 template<typename Expr, typename Context>
0124 typename proto::result_of::eval<Expr const, Context>::type
0125 eval(Expr const &e, Context &ctx)
0126 {
0127 return typename Context::template eval<Expr const>()(e, ctx);
0128 }
0129
0130
0131
0132 template<typename Expr, typename Context>
0133 typename proto::result_of::eval<Expr const, Context>::type
0134 eval(Expr const &e, Context const &ctx)
0135 {
0136 return typename Context::template eval<Expr const>()(e, ctx);
0137 }
0138 }}
0139
0140 #endif