make_expr.hpp
来自「Boost provides free peer-reviewed portab」· HPP 代码 · 共 1,099 行 · 第 1/4 页
HPP
1,099 行
, A0 const >::call(a0); } /// \overload /// template<typename Tag, typename Domain, typename B0> typename result_of::make_expr< Tag , Domain , B0 const >::type const make_expr(B0 const &b0) { return proto::detail::make_expr_< Tag , Domain , B0 const >::call(b0); } // Additional overloads generated by the preprocessor... #define BOOST_PP_ITERATION_PARAMS_1 \ (4, (2, BOOST_PROTO_MAX_ARITY, <boost/xpressive/proto/make_expr.hpp>, 3)) \ /**/ #include BOOST_PP_ITERATE() /// \brief Construct an expression of the requested tag type /// with a domain and with childres from the specified Fusion /// Random Access Sequence. /// /// This function template may be invoked either with or without /// specifying a \c Domain argument. If no domain is specified, /// the domain is deduced by examining in order the domains of the /// elements of \c sequence and taking the first that is not /// \c default_domain, if any such domain exists, or /// \c default_domain otherwise. /// /// Let <tt>wrap_\<N\>(s)</tt>, where \c s has type \c S, be defined /// such that: /// \li If <tt>fusion::value_at\<S,N\>::::type</tt> is a reference, /// <tt>wrap_\<N\>(s)</tt> is equivalent to /// <tt>as_arg\<Domain\>(fusion::at_c\<N\>(s))</tt>. /// \li Otherwise, <tt>wrap_\<N\>(s)</tt> is equivalent to /// <tt>as_expr\<Domain\>(fusion::at_c\<N\>(s))</tt>. /// /// Let <tt>make_\<Tag\>(b0,...bN)</tt> be defined as /// <tt>expr\<Tag, argsN\<B0,...BN\> \>::::make(b0,...bN)</tt> /// where \c Bx is the type of \c bx. /// /// \param sequence a Fusion Random Access Sequence. /// \return <tt>Domain::make(make_\<Tag\>(wrap_\<0\>(s),...wrap_\<N-1\>(S)))</tt>, /// where N is the size of \c Sequence. template<typename Tag, typename Sequence> typename lazy_disable_if< is_domain<Sequence> , result_of::unpack_expr<Tag, Sequence const> >::type const unpack_expr(Sequence const &sequence) { return proto::detail::unpack_expr_< Tag , deduce_domain , Sequence const , fusion::BOOST_PROTO_FUSION_RESULT_OF::size<Sequence>::type::value >::call(sequence); } /// \overload /// template<typename Tag, typename Domain, typename Sequence2> typename result_of::unpack_expr<Tag, Domain, Sequence2 const>::type const unpack_expr(Sequence2 const &sequence2) { return proto::detail::unpack_expr_< Tag , Domain , Sequence2 const , fusion::BOOST_PROTO_FUSION_RESULT_OF::size<Sequence2>::type::value >::call(sequence2); } /// INTERNAL ONLY /// template<typename Tag, typename Domain> struct is_callable<functional::make_expr<Tag, Domain> > : mpl::true_ {}; /// INTERNAL ONLY /// template<typename Tag, typename Domain> struct is_callable<functional::unpack_expr<Tag, Domain> > : mpl::true_ {}; /// INTERNAL ONLY /// template<typename Tag, typename Domain> struct is_callable<functional::unfused_expr<Tag, Domain> > : mpl::true_ {}; }} #undef BOOST_PROTO_AT #undef BOOST_PROTO_AT_TYPE #undef BOOST_PROTO_AS_ARG_AT #undef BOOST_PROTO_AS_ARG_AT_TYPE #endif // BOOST_PROTO_MAKE_EXPR_HPP_EAN_04_01_2005#elif BOOST_PP_ITERATION_FLAGS() == 1 #define N BOOST_PP_ITERATION() #define M BOOST_PP_SUB(BOOST_PROTO_MAX_ARITY, N) template<typename Tag, typename Domain BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)> struct make_expr_<Tag, Domain BOOST_PP_ENUM_TRAILING_PARAMS(N, A) BOOST_PP_ENUM_TRAILING_PARAMS(M, void BOOST_PP_INTERCEPT), void> { typedef proto::expr< Tag , BOOST_PP_CAT(args, N)<BOOST_PP_ENUM(N, BOOST_PROTO_AS_ARG_TYPE, (A, ~, Domain)) > > expr_type; typedef typename Domain::template apply<expr_type>::type type; static type const call(BOOST_PP_ENUM_BINARY_PARAMS(N, typename add_reference<A, >::type a)) { expr_type that = { BOOST_PP_ENUM(N, BOOST_PROTO_AS_ARG, (A, a, Domain)) }; return Domain::make(that); } }; template<typename Tag BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)> struct make_expr_<Tag, deduce_domain BOOST_PP_ENUM_TRAILING_PARAMS(N, A) BOOST_PP_ENUM_TRAILING_PARAMS(M, void BOOST_PP_INTERCEPT), void> : make_expr_< Tag , typename detail::deduce_domain_< typename domain_of< A0 >::type BOOST_PP_COMMA_IF(BOOST_PP_DEC(N)) BOOST_PP_ENUM_SHIFTED_PARAMS(N, A) >::type BOOST_PP_ENUM_TRAILING_PARAMS(N, A) > {}; template<typename Tag, typename Domain, typename Sequence> struct unpack_expr_<Tag, Domain, Sequence, N> { typedef proto::expr< Tag , BOOST_PP_CAT(args, N)< BOOST_PP_ENUM(N, BOOST_PROTO_AS_ARG_AT_TYPE, (Sequence const, ~, Domain)) > > expr_type; typedef typename Domain::template apply<expr_type>::type type; static type const call(Sequence const &sequence) { expr_type that = { BOOST_PP_ENUM(N, BOOST_PROTO_AS_ARG_AT, (Sequence const, sequence, Domain)) }; return Domain::make(that); } }; template<typename Tag, typename Sequence> struct unpack_expr_<Tag, deduce_domain, Sequence, N> : unpack_expr_< Tag , typename detail::deduce_domain_< typename domain_of< BOOST_PROTO_AT_TYPE(~, 0, (Sequence const, ~, ~)) >::type BOOST_PP_COMMA_IF(BOOST_PP_DEC(N)) BOOST_PP_ENUM_SHIFTED(N, BOOST_PROTO_AT_TYPE, (Sequence const, ~, ~)) >::type , Sequence , N > {}; #undef N #undef M#elif BOOST_PP_ITERATION_FLAGS() == 2 #define N BOOST_PP_ITERATION() template<typename This BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)> struct result<This(BOOST_PP_ENUM_PARAMS(N, A))> { typedef typename result_of::make_expr< Tag , Domain BOOST_PP_ENUM_TRAILING_PARAMS(N, A) >::type type; }; /// \overload /// template<BOOST_PP_ENUM_PARAMS(N, typename A)> typename result_of::make_expr< Tag , Domain BOOST_PP_ENUM_TRAILING_PARAMS(N, const A) >::type const operator ()(BOOST_PP_ENUM_BINARY_PARAMS(N, const A, &a)) const { return proto::detail::make_expr_< Tag , Domain BOOST_PP_ENUM_TRAILING_PARAMS(N, const A) >::call(BOOST_PP_ENUM_PARAMS(N, a)); } #undef N#elif BOOST_PP_ITERATION_FLAGS() == 3 #define N BOOST_PP_ITERATION() /// \overload /// template<typename Tag BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)> typename lazy_disable_if< is_domain<A0> , result_of::make_expr< Tag BOOST_PP_ENUM_TRAILING_PARAMS(N, const A) > >::type const make_expr(BOOST_PP_ENUM_BINARY_PARAMS(N, const A, &a)) { return proto::detail::make_expr_< Tag , deduce_domain BOOST_PP_ENUM_TRAILING_PARAMS(N, const A) >::call(BOOST_PP_ENUM_PARAMS(N, a)); } /// \overload /// template<typename Tag, typename Domain BOOST_PP_ENUM_TRAILING_PARAMS(N, typename B)> typename result_of::make_expr< Tag , Domain BOOST_PP_ENUM_TRAILING_PARAMS(N, const B) >::type const make_expr(BOOST_PP_ENUM_BINARY_PARAMS(N, const B, &b)) { return proto::detail::make_expr_< Tag , Domain BOOST_PP_ENUM_TRAILING_PARAMS(N, const B) >::call(BOOST_PP_ENUM_PARAMS(N, b)); } #undef N#endif // BOOST_PP_IS_ITERATING
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?