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

📄 make.hpp

📁 Boost provides free peer-reviewed portable C++ source libraries. We emphasize libraries that work
💻 HPP
📖 第 1 页 / 共 2 页
字号:
        ///     (which evaluates this procedure recursively). Note whether any        ///     substitutions took place during this operation.        /// \li Otherwise, if \c X is a transform, then let <tt>X'</tt> be        ///     <tt>when\<_, X\>::::result\<void(Expr, State, Data)\>::::type</tt>.        ///     Note that a substitution took place.        /// \li Otherwise, let <tt>X'</tt> be \c X, and note that no substitution        ///     took place.        /// \li If any substitutions took place in any of the above steps and        ///     <tt>T\<X0',X1',...\></tt> has a nested <tt>::type</tt> typedef,        ///     the result type is <tt>T\<X0',X1',...\>::::type</tt>.        /// \li Otherwise, the result type is <tt>T\<X0',X1',...\></tt>.        ///        /// Note that <tt>when\<\></tt> is implemented in terms of <tt>call\<\></tt>        /// and <tt>make\<\></tt>, so the above procedure is evaluated recursively.        template<typename Object>        struct make : transform<make<Object> >        {            template<typename Expr, typename State, typename Data>            struct impl : transform_impl<Expr, State, Data>            {                typedef typename detail::make_if_<Object, Expr, State, Data>::type result_type;                /// \return <tt>result_type()</tt>                result_type operator ()(                    typename impl::expr_param                  , typename impl::state_param                  , typename impl::data_param                ) const                {                    return result_type();                }            };        };        #define BOOST_PP_ITERATION_PARAMS_1 (3, (0, BOOST_PROTO_MAX_ARITY, <boost/proto/transform/make.hpp>))        #include BOOST_PP_ITERATE()        /// INTERNAL ONLY        ///        template<typename Object>        struct is_callable<make<Object> >          : mpl::true_        {};        /// INTERNAL ONLY        ///        template<typename PrimitiveTransform>        struct is_callable<protect<PrimitiveTransform> >          : mpl::true_        {};    }}    #endif#else    #define N BOOST_PP_ITERATION()        namespace detail        {            #if N > 0            template<typename T BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)>            struct nested_type_if<                T              , typelist<BOOST_PP_ENUM_PARAMS(N, A)>              , typename typelist<                    BOOST_PP_ENUM_BINARY_PARAMS(N, typename A, ::not_applied_ BOOST_PP_INTERCEPT)                >::type            >            {                typedef T type;                typedef void not_applied_;            };            template<                template<BOOST_PP_ENUM_PARAMS(N, typename BOOST_PP_INTERCEPT)> class R                BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)              , typename Expr, typename State, typename Data            >            struct make_<R<BOOST_PP_ENUM_PARAMS(N, A)>, Expr, State, Data                BOOST_MPL_AUX_LAMBDA_ARITY_PARAM(N)            >              : nested_type_if<                    #define TMP0(Z, M, DATA) make_if_<BOOST_PP_CAT(A, M), Expr, State, Data>                    #define TMP1(Z, M, DATA) typename TMP0(Z, M, DATA) ::type                    R<BOOST_PP_ENUM(N, TMP1, ~)>                  , typelist<BOOST_PP_ENUM(N, TMP0, ~) >                    #undef TMP0                    #undef TMP1                >            {};            #endif            template<                typename R                BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)              , typename Expr, typename State, typename Data            >            struct make_if_<R(BOOST_PP_ENUM_PARAMS(N, A)), Expr, State, Data, false>            {                typedef                    typename remove_const<                        typename remove_reference<                            typename when<_, R(BOOST_PP_ENUM_PARAMS(N, A))>                                ::template impl<Expr, State, Data>::result_type                        >::type                    >::type                type;            };            template<                typename R                BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)              , typename Expr, typename State, typename Data            >            struct make_if_<R(*)(BOOST_PP_ENUM_PARAMS(N, A)), Expr, State, Data, false>            {                typedef                    typename remove_const<                        typename remove_reference<                            typename when<_, R(BOOST_PP_ENUM_PARAMS(N, A))>                                ::template impl<Expr, State, Data>::result_type                        >::type                    >::type                type;            };            template<typename T, typename A>            struct construct_<proto::expr<T, A, N>, true>            {                typedef proto::expr<T, A, N> result_type;                template<BOOST_PP_ENUM_PARAMS(BOOST_PP_MAX(N, 1), typename A)>                result_type operator ()(BOOST_PP_ENUM_BINARY_PARAMS(BOOST_PP_MAX(N, 1), A, &a)) const                {                    return result_type::make(BOOST_PP_ENUM_PARAMS(BOOST_PP_MAX(N, 1), a));                }            };        }        /// \brief A PrimitiveTransform which computes a type by evaluating any        /// nested transforms and then constructs an object of that type with the        /// current expression, state and data, transformed according        /// to \c A0 through \c AN.        template<typename Object BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)>        struct make<Object(BOOST_PP_ENUM_PARAMS(N, A))>          : transform<make<Object(BOOST_PP_ENUM_PARAMS(N, A))> >        {            template<typename Expr, typename State, typename Data>            struct impl : transform_impl<Expr, State, Data>            {                /// \brief <tt>make\<Object\>::::result\<void(Expr, State, Data)\>::::type</tt>                typedef typename detail::make_if_<Object, Expr, State, Data>::type result_type;                //typedef typename detail::make_<Object, Expr, State, Data>::type result_type;                /// Let \c ax be <tt>when\<_, Ax\>()(expr, state, data)</tt>                /// for each \c x in <tt>[0,N]</tt>.                /// Let \c T be <tt>result\<void(Expr, State, Data)\>::::type</tt>.                /// Return <tt>T(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                {                    proto::detail::ignore_unused(expr);                    proto::detail::ignore_unused(state);                    proto::detail::ignore_unused(data);                    return detail::construct<result_type>(                        #define TMP(Z, M, DATA)                                                     \                            detail::as_lvalue(                                                      \                                typename when<_, BOOST_PP_CAT(A, M)>                                \                                    ::template impl<Expr, State, Data>()(expr, state, data)         \                            )                        BOOST_PP_ENUM(N, TMP, DATA)                        #undef TMP                    );                }            };        };        #if BOOST_WORKAROUND(__GNUC__, == 3) || (__GNUC__ == 4 && __GNUC_MINOR__ == 0)        // work around GCC bug        template<typename Tag, typename Args, long Arity BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)>        struct make<proto::expr<Tag, Args, Arity>(BOOST_PP_ENUM_PARAMS(N, A))>          : transform<make<proto::expr<Tag, Args, Arity>(BOOST_PP_ENUM_PARAMS(N, A))> >        {            template<typename Expr, typename State, typename Data>            struct impl : transform_impl<Expr, State, Data>            {                typedef proto::expr<Tag, Args, Arity> result_type;                result_type operator ()(                    typename impl::expr_param   expr                  , typename impl::state_param  state                  , typename impl::data_param   data                ) const                {                    return proto::expr<Tag, Args, Arity>::make(                        #define TMP(Z, M, DATA)                                                     \                            detail::as_lvalue(                                                      \                                typename when<_, BOOST_PP_CAT(A, M)>                                \                                    ::template impl<Expr, State, Data>()(expr, state, data)         \                            )                        BOOST_PP_ENUM(N, TMP, DATA)                        #undef TMP                    );                }            };        };        #endif    #undef N#endif

⌨️ 快捷键说明

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