Chris@16
|
1 #if !defined(BOOST_PROTO_DONT_USE_PREPROCESSED_FILES)
|
Chris@16
|
2
|
Chris@16
|
3 #include <boost/proto/context/detail/preprocessed/default_eval.hpp>
|
Chris@16
|
4
|
Chris@16
|
5 #elif !defined(BOOST_PP_IS_ITERATING)
|
Chris@16
|
6
|
Chris@16
|
7 #define BOOST_PROTO_DEFAULT_EVAL_SHIFTED(Z, M, DATA) \
|
Chris@16
|
8 BOOST_PROTO_DEFAULT_EVAL(Z, BOOST_PP_ADD(M, 2), DATA) \
|
Chris@16
|
9 /**/
|
Chris@16
|
10
|
Chris@16
|
11 #if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
|
Chris@16
|
12 #pragma wave option(preserve: 2, line: 0, output: "preprocessed/default_eval.hpp")
|
Chris@16
|
13 #endif
|
Chris@16
|
14
|
Chris@16
|
15 ///////////////////////////////////////////////////////////////////////////////
|
Chris@16
|
16 /// \file default_eval.hpp
|
Chris@16
|
17 /// Contains specializations of the default_eval\<\> class template.
|
Chris@16
|
18 //
|
Chris@16
|
19 // Copyright 2008 Eric Niebler. Distributed under the Boost
|
Chris@16
|
20 // Software License, Version 1.0. (See accompanying file
|
Chris@16
|
21 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
22
|
Chris@16
|
23 #if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
|
Chris@16
|
24 #pragma wave option(preserve: 1)
|
Chris@16
|
25 #endif
|
Chris@16
|
26
|
Chris@16
|
27 #define BOOST_PP_ITERATION_PARAMS_1 \
|
Chris@16
|
28 (3, (3, BOOST_PROTO_MAX_ARITY, <boost/proto/context/detail/default_eval.hpp>))
|
Chris@16
|
29 #include BOOST_PP_ITERATE()
|
Chris@16
|
30
|
Chris@16
|
31 #if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
|
Chris@16
|
32 #pragma wave option(output: null)
|
Chris@16
|
33 #endif
|
Chris@16
|
34
|
Chris@16
|
35 #undef BOOST_PROTO_DEFAULT_EVAL_SHIFTED
|
Chris@16
|
36
|
Chris@16
|
37 #else
|
Chris@16
|
38
|
Chris@16
|
39 #define N BOOST_PP_ITERATION()
|
Chris@16
|
40
|
Chris@16
|
41 template<typename Expr, typename Context>
|
Chris@16
|
42 struct default_eval<Expr, Context, proto::tag::function, N>
|
Chris@16
|
43 {
|
Chris@16
|
44 typedef
|
Chris@16
|
45 typename proto::detail::result_of_fixup<
|
Chris@16
|
46 BOOST_PROTO_DEFAULT_EVAL_TYPE(~, 0, Expr)
|
Chris@16
|
47 >::type
|
Chris@16
|
48 function_type;
|
Chris@16
|
49
|
Chris@16
|
50 typedef
|
Chris@16
|
51 typename BOOST_PROTO_RESULT_OF<
|
Chris@16
|
52 function_type(BOOST_PP_ENUM_SHIFTED(N, BOOST_PROTO_DEFAULT_EVAL_TYPE, Expr))
|
Chris@16
|
53 >::type
|
Chris@16
|
54 result_type;
|
Chris@16
|
55
|
Chris@16
|
56 result_type operator ()(Expr &expr, Context &context) const
|
Chris@16
|
57 {
|
Chris@16
|
58 return this->invoke(expr, context, is_member_function_pointer<function_type>());
|
Chris@16
|
59 }
|
Chris@16
|
60
|
Chris@16
|
61 private:
|
Chris@16
|
62 result_type invoke(Expr &expr, Context &context, mpl::false_) const
|
Chris@16
|
63 {
|
Chris@16
|
64 return BOOST_PROTO_DEFAULT_EVAL(~, 0, expr)(
|
Chris@16
|
65 BOOST_PP_ENUM_SHIFTED(N, BOOST_PROTO_DEFAULT_EVAL, expr)
|
Chris@16
|
66 );
|
Chris@16
|
67 }
|
Chris@16
|
68
|
Chris@16
|
69 result_type invoke(Expr &expr, Context &context, mpl::true_) const
|
Chris@16
|
70 {
|
Chris@16
|
71 BOOST_PROTO_USE_GET_POINTER();
|
Chris@16
|
72 typedef typename detail::class_member_traits<function_type>::class_type class_type;
|
Chris@16
|
73 return (
|
Chris@16
|
74 BOOST_PROTO_GET_POINTER(class_type, (BOOST_PROTO_DEFAULT_EVAL(~, 1, expr))) ->*
|
Chris@16
|
75 BOOST_PROTO_DEFAULT_EVAL(~, 0, expr)
|
Chris@16
|
76 )(BOOST_PP_ENUM(BOOST_PP_SUB(N, 2), BOOST_PROTO_DEFAULT_EVAL_SHIFTED, expr));
|
Chris@16
|
77 }
|
Chris@16
|
78 };
|
Chris@16
|
79
|
Chris@16
|
80 #undef N
|
Chris@16
|
81
|
Chris@16
|
82 #endif
|