expr.hpp

来自「Boost provides free peer-reviewed portab」· HPP 代码 · 共 412 行 · 第 1/2 页

HPP
412
字号
        #if IS_TERMINAL            /// \overload            ///            template<typename A0>            static expr make(A0 &a0)            {                expr that = {a0};                return that;            }            /// \overload            ///            template<typename A0, std::size_t N>            static expr make(A0 (&a0)[N], typename detail::if_is_array<proto_arg0, N>::type = 0)            {                expr that;                detail::checked_copy(a0, that.arg0);                return that;            }            /// \overload            ///            template<typename A0, std::size_t N>            static expr make(A0 const (&a0)[N], typename detail::if_is_array<proto_arg0, N>::type = 0)            {                expr that;                detail::checked_copy(a0, that.arg0);                return that;            }        #endif        #if 1 == BOOST_PP_ITERATION()            /// If \c Tag is \c boost::proto::tag::address_of and \c proto_arg0 is            /// \c proto::ref_\<T\>, then \c address_of_hack_type_ is <tt>T*</tt>.            /// Otherwise, it is some undefined type.            typedef typename detail::address_of_hack<Tag, proto_arg0>::type address_of_hack_type_;            /// \return The address of <tt>this->arg0</tt> if \c Tag is            /// \c boost::proto::tag::address_of. Otherwise, this function will            /// fail to compile.            ///            /// \attention Proto overloads <tt>operator&</tt>, which means that            /// proto-ified objects cannot have their addresses taken, unless we use            /// the following hack to make \c &x implicitly convertible to \c X*.            operator address_of_hack_type_() const            {                return boost::addressof(this->arg0.expr);            }        #endif            /// Assignment            ///            /// \param a The rhs.            /// \return A new \c expr\<\> node representing an assignment of \c a to \c *this.            template<typename A>            proto::expr<proto::tag::assign, args2<ref_<expr const>, typename result_of::as_arg<A>::type> > const            operator =(A &a) const            {                proto::expr<proto::tag::assign, args2<ref_<expr const>, typename result_of::as_arg<A>::type> > that = {{*this}, proto::as_arg(a)};                return that;            }            /// \overload            ///            template<typename A>            proto::expr<proto::tag::assign, args2<ref_<expr const>, typename result_of::as_arg<A const>::type> > const            operator =(A const &a) const            {                proto::expr<proto::tag::assign, args2<ref_<expr const>, typename result_of::as_arg<A const>::type> > that = {{*this}, proto::as_arg(a)};                return that;            }        #if IS_TERMINAL            /// \overload            ///            template<typename A>            proto::expr<proto::tag::assign, args2<ref_<expr>, typename result_of::as_arg<A>::type> > const            operator =(A &a)            {                proto::expr<proto::tag::assign, args2<ref_<expr>, typename result_of::as_arg<A>::type> > that = {{*this}, proto::as_arg(a)};                return that;            }            /// \overload            ///            template<typename A>            proto::expr<proto::tag::assign, args2<ref_<expr>, typename result_of::as_arg<A const>::type> > const            operator =(A const &a)            {                proto::expr<proto::tag::assign, args2<ref_<expr>, typename result_of::as_arg<A const>::type> > that = {{*this}, proto::as_arg(a)};                return that;            }        #endif            /// Subscript            ///            /// \param a The rhs.            /// \return A new \c expr\<\> node representing \c *this subscripted with \c a.            template<typename A>            proto::expr<proto::tag::subscript, args2<ref_<expr const>, typename result_of::as_arg<A>::type> > const            operator [](A &a) const            {                proto::expr<proto::tag::subscript, args2<ref_<expr const>, typename result_of::as_arg<A>::type> > that = {{*this}, proto::as_arg(a)};                return that;            }            /// \overload            ///            template<typename A>            proto::expr<proto::tag::subscript, args2<ref_<expr const>, typename result_of::as_arg<A const>::type> > const            operator [](A const &a) const            {                proto::expr<proto::tag::subscript, args2<ref_<expr const>, typename result_of::as_arg<A const>::type> > that = {{*this}, proto::as_arg(a)};                return that;            }        #if IS_TERMINAL            /// \overload            ///            template<typename A>            proto::expr<proto::tag::subscript, args2<ref_<expr>, typename result_of::as_arg<A>::type> > const            operator [](A &a)            {                proto::expr<proto::tag::subscript, args2<ref_<expr>, typename result_of::as_arg<A>::type> > that = {{*this}, proto::as_arg(a)};                return that;            }            /// \overload            ///            template<typename A>            proto::expr<proto::tag::subscript, args2<ref_<expr>, typename result_of::as_arg<A const>::type> > const            operator [](A const &a)            {                proto::expr<proto::tag::subscript, args2<ref_<expr>, typename result_of::as_arg<A const>::type> > that = {{*this}, proto::as_arg(a)};                return that;            }        #endif            /// Encodes the return type of \c expr\<\>::operator(), for use with \c boost::result_of\<\>            ///            template<typename Sig>            struct result            {                typedef typename result_of::funop<Sig, expr>::type type;            };            /// Function call            ///            /// \return A new \c expr\<\> node representing the function invocation of \c (*this)().            proto::expr<proto::tag::function, args1<ref_<expr const> > > const            operator ()() const            {                proto::expr<proto::tag::function, args1<ref_<expr const> > > that = {{*this}};                return that;            }        #if IS_TERMINAL            /// \overload            ///            proto::expr<proto::tag::function, args1<ref_<expr> > > const            operator ()()            {                proto::expr<proto::tag::function, args1<ref_<expr> > > that = {{*this}};                return that;            }        #endif    #define BOOST_PP_ITERATION_PARAMS_2 (3, (1, BOOST_PP_DEC(BOOST_PROTO_MAX_FUNCTION_CALL_ARITY), <boost/xpressive/proto/expr.hpp>))    #include BOOST_PP_ITERATE()        };    #undef ARG_COUNT    #undef IS_TERMINAL#elif BOOST_PP_ITERATION_DEPTH() == 2    #define N BOOST_PP_ITERATION()        /// \overload        ///        template<BOOST_PP_ENUM_PARAMS(N, typename A)>        typename result_of::BOOST_PP_CAT(funop, N)<expr const BOOST_PP_ENUM_TRAILING_PARAMS(N, const A)>::type const        operator ()(BOOST_PP_ENUM_BINARY_PARAMS(N, A, const &a)) const        {            return result_of::BOOST_PP_CAT(funop, N)<expr const BOOST_PP_ENUM_TRAILING_PARAMS(N, const A)>                ::call(*this BOOST_PP_ENUM_TRAILING_PARAMS(N, a));        }        #if IS_TERMINAL        /// \overload        ///        template<BOOST_PP_ENUM_PARAMS(N, typename A)>        typename result_of::BOOST_PP_CAT(funop, N)<expr BOOST_PP_ENUM_TRAILING_PARAMS(N, const A)>::type const        operator ()(BOOST_PP_ENUM_BINARY_PARAMS(N, A, const &a))        {            return result_of::BOOST_PP_CAT(funop, N)<expr BOOST_PP_ENUM_TRAILING_PARAMS(N, const A)>                ::call(*this BOOST_PP_ENUM_TRAILING_PARAMS(N, a));        }        #endif    #undef N#endif // BOOST_PP_ITERATION_DEPTH()#endif

⌨️ 快捷键说明

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