⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 call.hpp

📁 Boost provides free peer-reviewed portable C++ source libraries. We emphasize libraries that work
💻 HPP
📖 第 1 页 / 共 2 页
字号:
              : transform_impl<Expr, State, Data>            {                typedef typename when<_, A0>::template impl<Expr, State, Data>::result_type a0;                typedef typename when<_, A1>::template impl<Expr, State, Data>::result_type a1;                typedef typename detail::as_mono_function<Fun(a0, a1)>::type mono_fun;                typedef typename boost::result_of<mono_fun(a0, a1)>::type result_type;                result_type operator ()(                    typename impl2::expr_param   expr                  , typename impl2::state_param  state                  , typename impl2::data_param   data                ) const                {                    return mono_fun()(                        detail::as_lvalue(typename when<_, A0>::template impl<Expr, State, Data>()(expr, state, data))                      , detail::as_lvalue(typename when<_, A1>::template impl<Expr, State, Data>()(expr, state, data))                    );                }            };            template<typename Expr, typename State, typename Data>            struct impl2<Expr, State, Data, true>              : transform_impl<Expr, State, Data>            {                typedef typename when<_, A0>::template impl<Expr, State, Data>::result_type a0;                typedef typename when<_, A1>::template impl<Expr, State, Data>::result_type a1;                typedef typename Fun::template impl<a0, a1, Data>::result_type result_type;                result_type operator ()(                    typename impl2::expr_param   expr                  , typename impl2::state_param  state                  , typename impl2::data_param   data                ) const                {                    return typename Fun::template impl<a0, a1, Data>()(                        typename when<_, A0>::template impl<Expr, State, Data>()(expr, state, data)                      , typename when<_, A1>::template impl<Expr, State, Data>()(expr, state, data)                      , data                    );                }            };                /// Let \c x be <tt>when\<_, A0\>()(expr, state, data)</tt> and \c X                /// be the type of \c x.                /// Let \c y be <tt>when\<_, A1\>()(expr, state, data)</tt> and \c Y                /// be the type of \c y.                /// If \c Fun is a binary PolymorphicFunction object that accepts \c x                /// and \c y, then \c type is a typedef for                /// <tt>boost::result_of\<Fun(X, Y)\>::::type</tt>. Otherwise, it is                /// a typedef for <tt>boost::result_of\<Fun(X, Y, Data)\>::::type</tt>.            /// Either call the PolymorphicFunctionObject with 2 arguments:            /// the result of applying the \c A0 transform, and the            /// result of applying the \c A1 transform; or invoke the            /// PrimitiveTransform with 3 arguments: the result of applying            /// the \c A0 transform, the result of applying the \c A1            /// transform, and the data.            ///            /// Let \c x be <tt>when\<_, A0\>()(expr, state, data)</tt>.            /// Let \c y be <tt>when\<_, A1\>()(expr, state, data)</tt>.            /// If \c Fun is a binary PolymorphicFunction object that accepts \c x            /// and \c y, return <tt>Fun()(x, y)</tt>. Otherwise, return            /// <tt>Fun()(x, y, data)</tt>.            ///            /// \param expr The current expression            /// \param state The current state            /// \param data An arbitrary data            template<typename Expr, typename State, typename Data>            struct impl              : impl2<Expr, State, Data, is_transform<Fun>::value>            {};        };        /// \brief Call the PolymorphicFunctionObject or the        /// PrimitiveTransform with the current expression, state        /// and data, transformed according to \c A0, \c A1, and        /// \c A2, respectively.        template<typename Fun, typename A0, typename A1, typename A2>        struct call<Fun(A0, A1, A2)> : transform<call<Fun(A0, A1, A2)> >        {            template<typename Expr, typename State, typename Data, bool B>            struct impl2              : transform_impl<Expr, State, Data>            {                typedef typename when<_, A0>::template impl<Expr, State, Data>::result_type a0;                typedef typename when<_, A1>::template impl<Expr, State, Data>::result_type a1;                typedef typename when<_, A2>::template impl<Expr, State, Data>::result_type a2;                typedef typename detail::as_mono_function<Fun(a0, a1, a2)>::type mono_fun;                typedef typename boost::result_of<mono_fun(a0, a1, a2)>::type result_type;                result_type operator ()(                    typename impl2::expr_param   expr                  , typename impl2::state_param  state                  , typename impl2::data_param   data                ) const                {                    return mono_fun()(                        detail::as_lvalue(typename when<_, A0>::template impl<Expr, State, Data>()(expr, state, data))                      , detail::as_lvalue(typename when<_, A1>::template impl<Expr, State, Data>()(expr, state, data))                      , detail::as_lvalue(typename when<_, A2>::template impl<Expr, State, Data>()(expr, state, data))                    );                }            };            template<typename Expr, typename State, typename Data>            struct impl2<Expr, State, Data, true>              : transform_impl<Expr, State, Data>            {                typedef typename when<_, A0>::template impl<Expr, State, Data>::result_type a0;                typedef typename when<_, A1>::template impl<Expr, State, Data>::result_type a1;                typedef typename when<_, A2>::template impl<Expr, State, Data>::result_type a2;                typedef typename Fun::template impl<a0, a1, a2>::result_type result_type;                result_type operator ()(                    typename impl2::expr_param   expr                  , typename impl2::state_param  state                  , typename impl2::data_param   data                ) const                {                    return typename Fun::template impl<a0, a1, a2>()(                        typename when<_, A0>::template impl<Expr, State, Data>()(expr, state, data)                      , typename when<_, A1>::template impl<Expr, State, Data>()(expr, state, data)                      , typename when<_, A2>::template impl<Expr, State, Data>()(expr, state, data)                    );                }            };            /// Let \c x be <tt>when\<_, A0\>()(expr, state, data)</tt>.            /// Let \c y be <tt>when\<_, A1\>()(expr, state, data)</tt>.            /// Let \c z be <tt>when\<_, A2\>()(expr, state, data)</tt>.            /// Return <tt>Fun()(x, y, z)</tt>.            ///            /// \param expr The current expression            /// \param state The current state            /// \param data An arbitrary data            template<typename Expr, typename State, typename Data>            struct impl              : impl2<Expr, State, Data, is_transform<Fun>::value>            {};        };        #if BOOST_PROTO_MAX_ARITY > 3        #define BOOST_PP_ITERATION_PARAMS_1 (3, (4, BOOST_PROTO_MAX_ARITY, <boost/proto/transform/call.hpp>))        #include BOOST_PP_ITERATE()        #endif        /// INTERNAL ONLY        ///        template<typename Fun>        struct is_callable<call<Fun> >          : mpl::true_        {};    }} // namespace boost::proto    #endif#else    #define N BOOST_PP_ITERATION()        /// \brief Call the PolymorphicFunctionObject \c Fun with the        /// current expression, state and data, transformed according        /// to \c A0 through \c AN.        template<typename Fun BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)>        struct call<Fun(BOOST_PP_ENUM_PARAMS(N, A))> : transform<call<Fun(BOOST_PP_ENUM_PARAMS(N, A))> >        {            template<typename Expr, typename State, typename Data>            struct impl : transform_impl<Expr, State, Data>            {                #define M0(Z, M, DATA)                                                              \                    typedef                                                                         \                        typename when<_, BOOST_PP_CAT(A, M)>                                        \                            ::template impl<Expr, State, Data>                                      \                        ::result_type                                                               \                    BOOST_PP_CAT(a, M);                                                             \                    /**/                BOOST_PP_REPEAT(N, M0, ~)                #undef M0                typedef                    typename detail::as_mono_function<Fun(BOOST_PP_ENUM_PARAMS(N, a))>::type                mono_fun;                typedef                    typename boost::result_of<mono_fun(BOOST_PP_ENUM_PARAMS(N, a))>::type                result_type;                /// Let \c ax be <tt>when\<_, Ax\>()(expr, state, data)</tt>                /// for each \c x in <tt>[0,N]</tt>.                /// Return <tt>Fun()(a0, a1,... aN)</tt>.                ///                /// \param expr The current expression                /// \param state The current state                /// \param data An arbitrary data                result_type operator ()(                    typename impl::expr_param   expr                  , typename impl::state_param  state                  , typename impl::data_param   data                ) const                {                    #define M0(Z, M, DATA)                                                          \                        detail::as_lvalue(                                                          \                            typename when<_, BOOST_PP_CAT(A, M)>                                    \                                ::template impl<Expr, State, Data>()(expr, state, data))            \                    return mono_fun()(BOOST_PP_ENUM(N, M0, ~));                    #undef M0                }            };        };    #undef N#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -