Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 10:07:34

0001 #if !defined(BOOST_PROTO_DONT_USE_PREPROCESSED_FILES)
0002 
0003     #include <boost/proto/transform/detail/preprocessed/default_function_impl.hpp>
0004 
0005 #elif !defined(BOOST_PP_IS_ITERATING)
0006 
0007     #define BOOST_PROTO_DEF_FUN_INVOKE_ARG(Z, M, DATA)                                              \
0008         BOOST_PROTO_DEFAULT_EVAL(Z, BOOST_PP_ADD(M, 2), DATA)
0009 
0010     #if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
0011         #pragma wave option(preserve: 2, line: 0, output: "preprocessed/default_function_impl.hpp")
0012     #endif
0013 
0014     ///////////////////////////////////////////////////////////////////////////////
0015     /// \file default_function_impl.hpp
0016     /// Contains definition of the default_function_impl, the implementation of the
0017     /// _default transform for function-like nodes.
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/transform/detail/default_function_impl.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_DEF_FUN_INVOKE_ARG
0036 
0037 #else
0038 
0039     #define N BOOST_PP_ITERATION()
0040 
0041     template<typename Grammar, typename Expr, typename State, typename Data>
0042     struct default_function_impl<Grammar, Expr, State, Data, N>
0043       : transform_impl<Expr, State, Data>
0044     {
0045         BOOST_PP_REPEAT(N, BOOST_PROTO_DEFAULT_EVAL_TYPE, Expr)
0046 
0047         typedef
0048             typename proto::detail::result_of_fixup<r0>::type
0049         function_type;
0050 
0051         typedef
0052             typename BOOST_PROTO_RESULT_OF<
0053                 function_type(BOOST_PP_ENUM_SHIFTED_PARAMS(N, r))
0054             >::type
0055         result_type;
0056 
0057         result_type operator ()(
0058             typename default_function_impl::expr_param e
0059           , typename default_function_impl::state_param s
0060           , typename default_function_impl::data_param d
0061         ) const
0062         {
0063             return this->invoke(e, s, d, is_member_function_pointer<function_type>());
0064         }
0065 
0066     private:
0067         result_type invoke(
0068             typename default_function_impl::expr_param e
0069           , typename default_function_impl::state_param s
0070           , typename default_function_impl::data_param d
0071           , mpl::false_
0072         ) const
0073         {
0074             return BOOST_PROTO_DEFAULT_EVAL(~, 0, e)(
0075                 BOOST_PP_ENUM_SHIFTED(N, BOOST_PROTO_DEFAULT_EVAL, e)
0076             );
0077         }
0078 
0079         result_type invoke(
0080             typename default_function_impl::expr_param e
0081           , typename default_function_impl::state_param s
0082           , typename default_function_impl::data_param d
0083           , mpl::true_
0084         ) const
0085         {
0086             BOOST_PROTO_USE_GET_POINTER();
0087             typedef typename detail::class_member_traits<function_type>::class_type class_type;
0088             return (
0089                 BOOST_PROTO_GET_POINTER(class_type, (BOOST_PROTO_DEFAULT_EVAL(~, 1, e))) ->* 
0090                 BOOST_PROTO_DEFAULT_EVAL(~, 0, e)
0091             )(BOOST_PP_ENUM(BOOST_PP_SUB(N, 2), BOOST_PROTO_DEF_FUN_INVOKE_ARG, e));
0092         }
0093     };
0094 
0095     #undef N
0096 
0097 #endif