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