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

📄 closure.hpp

📁 C++的一个好库。。。现在很流行
💻 HPP
📖 第 1 页 / 共 4 页
字号:
                typedef typename phoenix::as_actor<I>::type i_t;
                typedef typename phoenix::as_actor<J>::type j_t;
                typedef typename phoenix::as_actor<K>::type k_t;
                typedef typename phoenix::as_actor<L>::type l_t;
                typedef typename phoenix::as_actor<M>::type m_t;
                typedef phoenix::tuple<
                            a_t, b_t, c_t, d_t, e_t, f_t, g_t, h_t, i_t, j_t,
                            k_t, l_t, m_t
                        > actor_tuple_t;

                return init_closure_parser<DerivedT2, actor_tuple_t>(
                        aux_derived(),
                        actor_tuple_t(
                            phoenix::as_actor<A>::convert(a),
                            phoenix::as_actor<B>::convert(b),
                            phoenix::as_actor<C>::convert(c),
                            phoenix::as_actor<D>::convert(d),
                            phoenix::as_actor<E>::convert(e),
                            phoenix::as_actor<F>::convert(f),
                            phoenix::as_actor<G>::convert(g),
                            phoenix::as_actor<H>::convert(h),
                            phoenix::as_actor<I>::convert(i),
                            phoenix::as_actor<J>::convert(j),
                            phoenix::as_actor<K>::convert(k),
                            phoenix::as_actor<L>::convert(l),
                            phoenix::as_actor<M>::convert(m)
                        )
                    );
            }

            template <
                typename A, typename B, typename C, typename D, typename E,
                typename F, typename G, typename H, typename I, typename J,
                typename K, typename L, typename M, typename N
            >
            init_closure_parser<
                DerivedT2,
                phoenix::tuple<
                    typename phoenix::as_actor<A>::type,
                    typename phoenix::as_actor<B>::type,
                    typename phoenix::as_actor<C>::type,
                    typename phoenix::as_actor<D>::type,
                    typename phoenix::as_actor<E>::type,
                    typename phoenix::as_actor<F>::type,
                    typename phoenix::as_actor<G>::type,
                    typename phoenix::as_actor<H>::type,
                    typename phoenix::as_actor<I>::type,
                    typename phoenix::as_actor<J>::type,
                    typename phoenix::as_actor<K>::type,
                    typename phoenix::as_actor<L>::type,
                    typename phoenix::as_actor<M>::type,
                    typename phoenix::as_actor<N>::type
                >
            >
            operator()(
                A const &a, B const &b, C const &c, D const &d, E const &e,
                F const &f, G const &g, H const &h, I const &i, J const &j,
                K const &k, L const &l, M const &m, N const &n
            ) const
            {
                typedef typename phoenix::as_actor<A>::type a_t;
                typedef typename phoenix::as_actor<B>::type b_t;
                typedef typename phoenix::as_actor<C>::type c_t;
                typedef typename phoenix::as_actor<D>::type d_t;
                typedef typename phoenix::as_actor<E>::type e_t;
                typedef typename phoenix::as_actor<F>::type f_t;
                typedef typename phoenix::as_actor<G>::type g_t;
                typedef typename phoenix::as_actor<H>::type h_t;
                typedef typename phoenix::as_actor<I>::type i_t;
                typedef typename phoenix::as_actor<J>::type j_t;
                typedef typename phoenix::as_actor<K>::type k_t;
                typedef typename phoenix::as_actor<L>::type l_t;
                typedef typename phoenix::as_actor<M>::type m_t;
                typedef typename phoenix::as_actor<N>::type n_t;
                typedef phoenix::tuple<
                            a_t, b_t, c_t, d_t, e_t, f_t, g_t, h_t, i_t, j_t,
                            k_t, l_t, m_t, n_t
                        > actor_tuple_t;

                return init_closure_parser<DerivedT2, actor_tuple_t>(
                        aux_derived(),
                        actor_tuple_t(
                            phoenix::as_actor<A>::convert(a),
                            phoenix::as_actor<B>::convert(b),
                            phoenix::as_actor<C>::convert(c),
                            phoenix::as_actor<D>::convert(d),
                            phoenix::as_actor<E>::convert(e),
                            phoenix::as_actor<F>::convert(f),
                            phoenix::as_actor<G>::convert(g),
                            phoenix::as_actor<H>::convert(h),
                            phoenix::as_actor<I>::convert(i),
                            phoenix::as_actor<J>::convert(j),
                            phoenix::as_actor<K>::convert(k),
                            phoenix::as_actor<L>::convert(l),
                            phoenix::as_actor<M>::convert(m),
                            phoenix::as_actor<N>::convert(n)
                        )
                    );
            }

            template <
                typename A, typename B, typename C, typename D, typename E,
                typename F, typename G, typename H, typename I, typename J,
                typename K, typename L, typename M, typename N, typename O
            >
            init_closure_parser<
                DerivedT2,
                phoenix::tuple<
                    typename phoenix::as_actor<A>::type,
                    typename phoenix::as_actor<B>::type,
                    typename phoenix::as_actor<C>::type,
                    typename phoenix::as_actor<D>::type,
                    typename phoenix::as_actor<E>::type,
                    typename phoenix::as_actor<F>::type,
                    typename phoenix::as_actor<G>::type,
                    typename phoenix::as_actor<H>::type,
                    typename phoenix::as_actor<I>::type,
                    typename phoenix::as_actor<J>::type,
                    typename phoenix::as_actor<K>::type,
                    typename phoenix::as_actor<L>::type,
                    typename phoenix::as_actor<M>::type,
                    typename phoenix::as_actor<N>::type,
                    typename phoenix::as_actor<O>::type
                >
            >
            operator()(
                A const &a, B const &b, C const &c, D const &d, E const &e,
                F const &f, G const &g, H const &h, I const &i, J const &j,
                K const &k, L const &l, M const &m, N const &n, O const &o
            ) const
            {
                typedef typename phoenix::as_actor<A>::type a_t;
                typedef typename phoenix::as_actor<B>::type b_t;
                typedef typename phoenix::as_actor<C>::type c_t;
                typedef typename phoenix::as_actor<D>::type d_t;
                typedef typename phoenix::as_actor<E>::type e_t;
                typedef typename phoenix::as_actor<F>::type f_t;
                typedef typename phoenix::as_actor<G>::type g_t;
                typedef typename phoenix::as_actor<H>::type h_t;
                typedef typename phoenix::as_actor<I>::type i_t;
                typedef typename phoenix::as_actor<J>::type j_t;
                typedef typename phoenix::as_actor<K>::type k_t;
                typedef typename phoenix::as_actor<L>::type l_t;
                typedef typename phoenix::as_actor<M>::type m_t;
                typedef typename phoenix::as_actor<N>::type n_t;
                typedef typename phoenix::as_actor<O>::type o_t;
                typedef phoenix::tuple<
                            a_t, b_t, c_t, d_t, e_t, f_t, g_t, h_t, i_t, j_t,
                            k_t, l_t, m_t, n_t, o_t
                        > actor_tuple_t;

                return init_closure_parser<DerivedT2, actor_tuple_t>(
                        aux_derived(),
                        actor_tuple_t(
                            phoenix::as_actor<A>::convert(a),
                            phoenix::as_actor<B>::convert(b),
                            phoenix::as_actor<C>::convert(c),
                            phoenix::as_actor<D>::convert(d),
                            phoenix::as_actor<E>::convert(e),
                            phoenix::as_actor<F>::convert(f),
                            phoenix::as_actor<G>::convert(g),
                            phoenix::as_actor<H>::convert(h),
                            phoenix::as_actor<I>::convert(i),
                            phoenix::as_actor<J>::convert(j),
                            phoenix::as_actor<K>::convert(k),
                            phoenix::as_actor<L>::convert(l),
                            phoenix::as_actor<M>::convert(m),
                            phoenix::as_actor<N>::convert(n),
                            phoenix::as_actor<O>::convert(o)
                        )
                    );
            }

    #endif
    #endif
    #endif
    #endif
        };

        ~closure() {}
    };

    ///////////////////////////////////////////////////////////////////////////
    //
    //  overloads for chseq_p and str_p taking in phoenix actors
    //
    ///////////////////////////////////////////////////////////////////////////
    template <typename ActorT>
    struct container_begin
    {
        typedef container_begin<ActorT> self_t;

        template <typename TupleT>
        struct result
        {
            typedef typename phoenix::actor_result<ActorT, TupleT>
                ::plain_type::iterator type;
        };

        container_begin(ActorT actor_)
        : actor(actor_) {}

        template <typename TupleT>
        typename phoenix::actor_result<self_t, TupleT>::type
        eval(TupleT const& /*args*/) const
        { return actor().begin(); }

        ActorT actor;
    };

    template <typename ActorT>
    struct container_end
    {
        typedef container_begin<ActorT> self_t;

        template <typename TupleT>
        struct result
        {
            typedef typename phoenix::actor_result<ActorT, TupleT>
                ::plain_type::iterator type;
        };

        container_end(ActorT actor_)
        : actor(actor_) {}

        template <typename TupleT>
        typename phoenix::actor_result<self_t, TupleT>::type
        eval(TupleT const& /*args*/) const
        { return actor().end(); }

        ActorT actor;
    };

    template <typename BaseT>
    inline f_chseq<
        phoenix::actor<container_begin<phoenix::actor<BaseT> > >,
        phoenix::actor<container_end<phoenix::actor<BaseT> > >
    >
    f_chseq_p(phoenix::actor<BaseT> const& a)
    {
        typedef phoenix::actor<container_begin<phoenix::actor<BaseT> > >
            container_begin_t;
        typedef phoenix::actor<container_end<phoenix::actor<BaseT> > >
            container_end_t;
        typedef f_chseq<container_begin_t, container_end_t> result_t;

        return result_t(container_begin_t(a), container_end_t(a));
    }

    template <typename BaseT>
    inline f_strlit<
        phoenix::actor<container_begin<phoenix::actor<BaseT> > >,
        phoenix::actor<container_end<phoenix::actor<BaseT> > >
    >
    f_str_p(phoenix::actor<BaseT> const& a)
    {
        typedef phoenix::actor<container_begin<phoenix::actor<BaseT> > >
            container_begin_t;
        typedef phoenix::actor<container_end<phoenix::actor<BaseT> > >
            container_end_t;
        typedef f_strlit<container_begin_t, container_end_t> result_t;

        return result_t(container_begin_t(a), container_end_t(a));
    }

}} // namespace boost::spirit

#endif

⌨️ 快捷键说明

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