Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:50:19

0001 #if !defined(BOOST_PROTO_DONT_USE_PREPROCESSED_FILES)
0002 
0003     #include <boost/proto/context/detail/preprocessed/default_eval.hpp>
0004 
0005 #elif !defined(BOOST_PP_IS_ITERATING)
0006 
0007     #define BOOST_PROTO_DEFAULT_EVAL_SHIFTED(Z, M, DATA)                                            \
0008         BOOST_PROTO_DEFAULT_EVAL(Z, BOOST_PP_ADD(M, 2), DATA)                                       \
0009         /**/
0010 
0011     #if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
0012         #pragma wave option(preserve: 2, line: 0, output: "preprocessed/default_eval.hpp")
0013     #endif
0014 
0015     ///////////////////////////////////////////////////////////////////////////////
0016     /// \file default_eval.hpp
0017     /// Contains specializations of the default_eval\<\> class template.
0018     //
0019     //  Copyright 2008 Eric Niebler. Distributed under the Boost
0020     //  Software License, Version 1.0. (See accompanying file
0021     //  LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0022 
0023     #if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
0024         #pragma wave option(preserve: 1)
0025     #endif
0026 
0027     #define BOOST_PP_ITERATION_PARAMS_1                                                             \
0028         (3, (3, BOOST_PROTO_MAX_ARITY, <boost/proto/context/detail/default_eval.hpp>))
0029     #include BOOST_PP_ITERATE()
0030 
0031     #if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
0032         #pragma wave option(output: null)
0033     #endif
0034 
0035     #undef BOOST_PROTO_DEFAULT_EVAL_SHIFTED
0036 
0037 #else
0038 
0039     #define N BOOST_PP_ITERATION()
0040 
0041     template<typename Expr, typename Context>
0042     struct default_eval<Expr, Context, proto::tag::function, N>
0043     {
0044         typedef
0045             typename proto::detail::result_of_fixup<
0046                 BOOST_PROTO_DEFAULT_EVAL_TYPE(~, 0, Expr)
0047             >::type
0048         function_type;
0049 
0050         typedef
0051             typename BOOST_PROTO_RESULT_OF<
0052                 function_type(BOOST_PP_ENUM_SHIFTED(N, BOOST_PROTO_DEFAULT_EVAL_TYPE, Expr))
0053             >::type
0054         result_type;
0055 
0056         result_type operator ()(Expr &expr, Context &context) const
0057         {
0058             return this->invoke(expr, context, is_member_function_pointer<function_type>());
0059         }
0060 
0061     private:
0062         result_type invoke(Expr &expr, Context &context, mpl::false_) const
0063         {
0064             return BOOST_PROTO_DEFAULT_EVAL(~, 0, expr)(
0065                 BOOST_PP_ENUM_SHIFTED(N, BOOST_PROTO_DEFAULT_EVAL, expr)
0066             );
0067         }
0068 
0069         result_type invoke(Expr &expr, Context &context, mpl::true_) const
0070         {
0071             BOOST_PROTO_USE_GET_POINTER();
0072             typedef typename detail::class_member_traits<function_type>::class_type class_type;
0073             return (
0074                 BOOST_PROTO_GET_POINTER(class_type, (BOOST_PROTO_DEFAULT_EVAL(~, 1, expr))) ->*
0075                 BOOST_PROTO_DEFAULT_EVAL(~, 0, expr)
0076             )(BOOST_PP_ENUM(BOOST_PP_SUB(N, 2), BOOST_PROTO_DEFAULT_EVAL_SHIFTED, expr));
0077         }
0078     };
0079 
0080     #undef N
0081 
0082 #endif