Back to home page

EIC code displayed by LXR

 
 

    


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

0001 #if !defined(BOOST_PROTO_DONT_USE_PREPROCESSED_FILES)
0002 
0003     #include <boost/proto/transform/detail/preprocessed/call.hpp>
0004 
0005 #elif !defined(BOOST_PP_IS_ITERATING)
0006 
0007     #define BOOST_PROTO_NTH_RESULT_TYPE(Z, M, DATA)                                                 \
0008         typedef                                                                                     \
0009             typename when<_, BOOST_PP_CAT(A, M)>::template impl<Expr, State, Data>                  \
0010         BOOST_PP_CAT(a, M);                                                                         \
0011         typedef typename BOOST_PP_CAT(a, M)::result_type BOOST_PP_CAT(b, M);                        \
0012         /**/
0013 
0014     #define BOOST_PROTO_NTH_RESULT(Z, M, DATA)                                                      \
0015         detail::as_lvalue(BOOST_PP_CAT(a, M)()(e, s, d))                                            \
0016         /**/
0017 
0018     #if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
0019         #pragma wave option(preserve: 2, line: 0, output: "preprocessed/call.hpp")
0020     #endif
0021 
0022     ///////////////////////////////////////////////////////////////////////////////
0023     /// \file call.hpp
0024     /// Contains definition of the call<> transform.
0025     //
0026     //  Copyright 2008 Eric Niebler. Distributed under the Boost
0027     //  Software License, Version 1.0. (See accompanying file
0028     //  LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0029 
0030     #if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
0031         #pragma wave option(preserve: 1)
0032     #endif
0033 
0034     #define BOOST_PP_ITERATION_PARAMS_1                                                             \
0035         (3, (1, BOOST_PROTO_MAX_ARITY, <boost/proto/transform/detail/call.hpp>))
0036     #include BOOST_PP_ITERATE()
0037 
0038     #if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
0039         #pragma wave option(output: null)
0040     #endif
0041 
0042     #undef BOOST_PROTO_NTH_RESULT
0043     #undef BOOST_PROTO_NTH_RESULT_TYPE
0044 
0045 #else
0046 
0047     #define N BOOST_PP_ITERATION()
0048 
0049     #if N > 3
0050     /// \brief Call the PolymorphicFunctionObject \c Fun with the
0051     /// current expression, state and data, transformed according
0052     /// to \c A0 through \c AN.
0053     template<typename Fun BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)>
0054     struct call<Fun(BOOST_PP_ENUM_PARAMS(N, A))> : transform<call<Fun(BOOST_PP_ENUM_PARAMS(N, A))> >
0055     {
0056         template<typename Expr, typename State, typename Data>
0057         struct impl : transform_impl<Expr, State, Data>
0058         {
0059             BOOST_PP_REPEAT(N, BOOST_PROTO_NTH_RESULT_TYPE, ~)
0060 
0061             typedef detail::poly_function_traits<Fun, Fun(BOOST_PP_ENUM_PARAMS(N, b))> function_traits;
0062             typedef typename function_traits::result_type result_type;
0063 
0064             /// Let \c ax be <tt>when\<_, Ax\>()(e, s, d)</tt>
0065             /// for each \c x in <tt>[0,N]</tt>.
0066             /// Return <tt>Fun()(a0, a1,... aN)</tt>.
0067             ///
0068             /// \param e The current expression
0069             /// \param s The current state
0070             /// \param d An arbitrary data
0071             BOOST_FORCEINLINE
0072             result_type operator ()(
0073                 typename impl::expr_param   e
0074               , typename impl::state_param  s
0075               , typename impl::data_param   d
0076             ) const
0077             {
0078                 typedef typename function_traits::function_type function_type;
0079                 return function_type()(BOOST_PP_ENUM(N, BOOST_PROTO_NTH_RESULT, ~));
0080             }
0081         };
0082     };
0083     #endif
0084 
0085     #if N > 0
0086     /// \brief Call the PolymorphicFunctionObject \c Fun with the
0087     /// current expression, state and data, transformed according
0088     /// to \c A0 through \c AN.
0089     template<typename Fun BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)>
0090     struct call<Fun(BOOST_PP_ENUM_PARAMS(N, A)...)> : transform<call<Fun(BOOST_PP_ENUM_PARAMS(N, A)...)> >
0091     {
0092         template<typename Expr, typename State, typename Data>
0093         struct impl
0094           : call<
0095                 typename detail::expand_pattern<
0096                     proto::arity_of<Expr>::value // BUGBUG this isn't right. Could be pack(_child), should use arity of child!
0097                   , BOOST_PP_CAT(A, BOOST_PP_DEC(N))
0098                   , detail::BOOST_PP_CAT(expand_pattern_rest_, BOOST_PP_DEC(N))<
0099                         Fun
0100                         BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_DEC(N), A)
0101                     >
0102                 >::type
0103             >::template impl<Expr, State, Data>
0104         {};
0105     };
0106     #endif
0107 
0108     #undef N
0109 
0110 #endif