binders.hpp

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

HPP
2,334
字号
};//////////////////////////////////template <typename T, typename ClassT>inline member_var_ptr<T, ClassT>bind(T ClassT::*mp){    return member_var_ptr<T, ClassT>(mp);}///////////////////////////////////////////////////////////////////////////////////  Function pointer binder (main class)/////////////////////////////////////////////////////////////////////////////////template <    typename RT    ,   typename A = nil_t    ,   typename B = nil_t    ,   typename C = nil_t#if PHOENIX_LIMIT > 3    ,   typename D = nil_t    ,   typename E = nil_t    ,   typename F = nil_t#if PHOENIX_LIMIT > 6    ,   typename G = nil_t    ,   typename H = nil_t    ,   typename I = nil_t#if PHOENIX_LIMIT > 9    ,   typename J = nil_t    ,   typename K = nil_t    ,   typename L = nil_t#if PHOENIX_LIMIT > 12    ,   typename M = nil_t    ,   typename N = nil_t    ,   typename O = nil_t#endif#endif#endif#endif    ,   typename NU = nil_t  // Not used>struct function_ptr_action;//////////////////////////////////template <    typename RT    ,   typename A = nil_t    ,   typename B = nil_t    ,   typename C = nil_t#if PHOENIX_LIMIT > 3    ,   typename D = nil_t    ,   typename E = nil_t    ,   typename F = nil_t#if PHOENIX_LIMIT > 6    ,   typename G = nil_t    ,   typename H = nil_t    ,   typename I = nil_t#if PHOENIX_LIMIT > 9    ,   typename J = nil_t    ,   typename K = nil_t    ,   typename L = nil_t#if PHOENIX_LIMIT > 12    ,   typename M = nil_t    ,   typename N = nil_t    ,   typename O = nil_t#endif#endif#endif#endif>struct function_ptr:   public function<function_ptr_action<RT    , A, B, C#if PHOENIX_LIMIT > 3    , D, E, F#if PHOENIX_LIMIT > 6    , G, H, I#if PHOENIX_LIMIT > 9    , J, K, L#if PHOENIX_LIMIT > 12    , M, N, O#endif#endif#endif#endif    > > {    typedef function_ptr_action<RT        , A, B, C#if PHOENIX_LIMIT > 3        , D, E, F#if PHOENIX_LIMIT > 6        , G, H, I#if PHOENIX_LIMIT > 9        , J, K, L#if PHOENIX_LIMIT > 12        , M, N, O#endif#endif#endif#endif    > action_t;    template <typename FPT>    function_ptr(FPT fp)    :   function<action_t>(action_t(fp)) {}};///////////////////////////////////////////////////////////////////////////////////  Function pointer binder (specialization for 0 arg)/////////////////////////////////////////////////////////////////////////////////template <typename RT>struct function_ptr_action<RT,    nil_t, nil_t, nil_t,#if PHOENIX_LIMIT > 3    nil_t, nil_t, nil_t,#if PHOENIX_LIMIT > 6    nil_t, nil_t, nil_t,#if PHOENIX_LIMIT > 9    nil_t, nil_t, nil_t,#if PHOENIX_LIMIT > 12    nil_t, nil_t, nil_t,#endif#endif#endif#endif    nil_t   //  Unused> {    typedef RT result_type;    typedef RT(*func_ptr_t)();    function_ptr_action(func_ptr_t fptr_)    :   fptr(fptr_) {}    result_type operator()() const    { return fptr(); }    func_ptr_t fptr;};//////////////////////////////////template <typename RT>inline function_ptr<RT>bind(RT(*fptr)()){    return function_ptr<RT>(fptr);}///////////////////////////////////////////////////////////////////////////////////  Function pointer binder (specialization for 1 arg)/////////////////////////////////////////////////////////////////////////////////template <typename RT, typename A>struct function_ptr_action<RT,    A, nil_t, nil_t,#if PHOENIX_LIMIT > 3    nil_t, nil_t, nil_t,#if PHOENIX_LIMIT > 6    nil_t, nil_t, nil_t,#if PHOENIX_LIMIT > 9    nil_t, nil_t, nil_t,#if PHOENIX_LIMIT > 12    nil_t, nil_t, nil_t,#endif#endif#endif#endif    nil_t   //  Unused> {    typedef RT result_type;    typedef RT(*func_ptr_t)(A);    template <typename A_>    struct result { typedef result_type type; };    function_ptr_action(func_ptr_t fptr_)    :   fptr(fptr_) {}    result_type operator()(A a) const    { return fptr(a); }    func_ptr_t fptr;};//////////////////////////////////template <typename RT, typename A>inline function_ptr<RT, A>bind(RT(*fptr)(A)){    return function_ptr<RT, A>(fptr);}///////////////////////////////////////////////////////////////////////////////////  Function pointer binder (specialization for 2 args)/////////////////////////////////////////////////////////////////////////////////template <typename RT, typename A, typename B>struct function_ptr_action<RT,    A, B, nil_t,#if PHOENIX_LIMIT > 3    nil_t, nil_t, nil_t,#if PHOENIX_LIMIT > 6    nil_t, nil_t, nil_t,#if PHOENIX_LIMIT > 9    nil_t, nil_t, nil_t,#if PHOENIX_LIMIT > 12    nil_t, nil_t, nil_t,#endif#endif#endif#endif    nil_t   //  Unused> {    typedef RT result_type;    typedef RT(*func_ptr_t)(A, B);    template <typename A_, typename B_>    struct result { typedef result_type type; };    function_ptr_action(func_ptr_t fptr_)    :   fptr(fptr_) {}    result_type operator()(A a, B b) const    { return fptr(a, b); }    func_ptr_t fptr;};//////////////////////////////////template <typename RT, typename A, typename B>inline function_ptr<RT, A, B>bind(RT(*fptr)(A, B)){    return function_ptr<RT, A, B>(fptr);}///////////////////////////////////////////////////////////////////////////////////  Function pointer binder (specialization for 3 args)/////////////////////////////////////////////////////////////////////////////////template <typename RT, typename A, typename B, typename C>struct function_ptr_action<RT,    A, B, C,#if PHOENIX_LIMIT > 3    nil_t, nil_t, nil_t,#if PHOENIX_LIMIT > 6    nil_t, nil_t, nil_t,#if PHOENIX_LIMIT > 9    nil_t, nil_t, nil_t,#if PHOENIX_LIMIT > 12    nil_t, nil_t, nil_t,#endif#endif#endif#endif    nil_t   //  Unused> {    typedef RT result_type;    typedef RT(*func_ptr_t)(A, B, C);    template <typename A_, typename B_, typename C_>    struct result { typedef result_type type; };    function_ptr_action(func_ptr_t fptr_)    :   fptr(fptr_) {}    result_type operator()(A a, B b, C c) const    { return fptr(a, b, c); }    func_ptr_t fptr;};//////////////////////////////////template <typename RT, typename A, typename B, typename C>inline function_ptr<RT, A, B, C>bind(RT(*fptr)(A, B, C)){    return function_ptr<RT, A, B, C>(fptr);}#if PHOENIX_LIMIT > 3///////////////////////////////////////////////////////////////////////////////////  Function pointer binder (specialization for 4 args)/////////////////////////////////////////////////////////////////////////////////template <typename RT, typename A, typename B, typename C, typename D>struct function_ptr_action<RT,    A, B, C, D, nil_t, nil_t,#if PHOENIX_LIMIT > 6    nil_t, nil_t, nil_t,#if PHOENIX_LIMIT > 9    nil_t, nil_t, nil_t,#if PHOENIX_LIMIT > 12    nil_t, nil_t, nil_t,#endif#endif#endif    nil_t   //  Unused> {    typedef RT result_type;    typedef RT(*func_ptr_t)(A, B, C, D);    template <typename A_, typename B_, typename C_, typename D_>    struct result { typedef result_type type; };    function_ptr_action(func_ptr_t fptr_)    :   fptr(fptr_) {}    result_type operator()(A a, B b, C c, D d) const    { return fptr(a, b, c, d); }    func_ptr_t fptr;};//////////////////////////////////template <typename RT, typename A, typename B, typename C, typename D>inline function_ptr<RT, A, B, C, D>bind(RT(*fptr)(A, B, C, D)){    return function_ptr<RT, A, B, C, D>(fptr);}///////////////////////////////////////////////////////////////////////////////////  Function pointer binder (specialization for 5 args)/////////////////////////////////////////////////////////////////////////////////template <typename RT,    typename A, typename B, typename C, typename D, typename E>struct function_ptr_action<RT,    A, B, C, D, E, nil_t,#if PHOENIX_LIMIT > 6    nil_t, nil_t, nil_t,#if PHOENIX_LIMIT > 9    nil_t, nil_t, nil_t,#if PHOENIX_LIMIT > 12    nil_t, nil_t, nil_t,#endif#endif#endif    nil_t   //  Unused> {    typedef RT result_type;    typedef RT(*func_ptr_t)(A, B, C, D, E);    template <        typename A_, typename B_, typename C_, typename D_, typename E_    >    struct result { typedef result_type type; };    function_ptr_action(func_ptr_t fptr_)    :   fptr(fptr_) {}    result_type operator()(        A a, B b, C c, D d, E e    ) const    { return fptr(a, b, c, d, e); }    func_ptr_t fptr;};//////////////////////////////////template <typename RT,    typename A, typename B, typename C, typename D, typename E>inline function_ptr<RT, A, B, C, D, E>bind(RT(*fptr)(A, B, C, D, E)){    return function_ptr<RT, A, B, C, D, E>(fptr);}///////////////////////////////////////////////////////////////////////////////////  Function pointer binder (specialization for 6 args)/////////////////////////////////////////////////////////////////////////////////template <typename RT,    typename A, typename B, typename C, typename D, typename E,    typename F>struct function_ptr_action<RT,    A, B, C, D, E, F,#if PHOENIX_LIMIT > 6    nil_t, nil_t, nil_t,#if PHOENIX_LIMIT > 9    nil_t, nil_t, nil_t,#if PHOENIX_LIMIT > 12    nil_t, nil_t, nil_t,#endif#endif#endif    nil_t   //  Unused> {    typedef RT result_type;    typedef RT(*func_ptr_t)(A, B, C, D, E, F);    template <        typename A_, typename B_, typename C_, typename D_, typename E_,        typename F_    >    struct result { typedef result_type type; };    function_ptr_action(func_ptr_t fptr_)    :   fptr(fptr_) {}    result_type operator()(        A a, B b, C c, D d, E e,        F f    ) const    { return fptr(a, b, c, d, e, f); }    func_ptr_t fptr;};//////////////////////////////////template <typename RT,    typename A, typename B, typename C, typename D, typename E,    typename F>inline function_ptr<RT, A, B, C, D, E, F>bind(RT(*fptr)(A, B, C, D, E, F)){    return function_ptr<RT, A, B, C, D, E, F>(fptr);}#if PHOENIX_LIMIT > 6///////////////////////////////////////////////////////////////////////////////////  Function pointer binder (specialization for 7 args)/////////////////////////////////////////////////////////////////////////////////template <typename RT,    typename A, typename B, typename C, typename D, typename E,    typename F, typename G>struct function_ptr_action<RT,    A, B, C, D, E, F, G, nil_t, nil_t,#if PHOENIX_LIMIT > 9    nil_t, nil_t, nil_t,#if PHOENIX_LIMIT > 12    nil_t, nil_t, nil_t,

⌨️ 快捷键说明

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