头一回发博客,来分享个有关C++类型萃取的编写技巧

废话不多说,上来贴代码最实在,哈哈!

以下代码量有点多,不过这都是在下一手一手敲出来的,小巧好用,把以下代码复制出来,放到相应的hpp文件即可,VS,GCC下均能编译通过

 1 #include<iostream>
 2 #include "../../traits/traits.hpp"
 3
 4
 5 using namespace std;
 6
 7
 8 int show(char i, int j)
 9 {
10     return 1;
11 }
12
13 struct Stu
14 {
15     int show(char i, int j)
16     {
17         return 1;
18     }
19 };
20
21 int main()
22 {
23     // 变量;类型萃取
24     traits::type_traits<int>::const_value_type i = 5; // 通过traits::type_traits可以萃取到int类型的各种"衍生"类型,如指针什么的
25
26     // 以下是C函数的相关萃取
27     traits::function_traits<int(char, int)>::FunctionP_Type func_ptr = show; // 得到指针
28     func_ptr(‘a‘, 4);
29
30     cout << traits::function_traits<int(char, int)>::arity << endl; // 萃取出参数个数
31     cout << typeid(traits::function_traits<int(char, int)>::arg2).name() << endl;//萃取出参数1的类型
32     cout << typeid(traits::function_traits<int(char, int)>::arg1).name() << endl;//萃取出参数2的类型
33
34     // 以下是类成员函数的相关萃取
35     traits::mfunction_traits<int(Stu::*)(char, int)>::MFunctionP_Type mfunc_ptr = &Stu::show; // 得到指针
36     Stu stu;
37     ((&stu)->*mfunc_ptr)(‘a‘, 4);
38
39     cout << typeid(traits::mfunction_traits<int(Stu::*)(char, int)>::arg2).name() << endl;//萃取出参数1的类型
40     cout << typeid(traits::mfunction_traits<int(Stu::*)(char, int)>::arg1).name() << endl;//萃取出参数2的类型
41     cout << typeid(traits::mfunction_traits<int(Stu::*)(char, int)>::result_type).name() << endl;//萃取出返回值
42     cout << typeid(traits::mfunction_traits<int(Stu::*)(char, int)>::class_type).name() << endl;//萃取出类类型
43
44     // 以下展示从C函数指针转为类成员函数指针的技巧
45     traits::fun_to_mem_converter<int(char, int), Stu>::MFunctionP_Type mfunc_ptr2 = mfunc_ptr;
46
47     // 以下展示从类成员函数指针转为C函数指针的技巧
48     traits::mem_to_fun_converter<int(Stu::*)(char, int)>::FunctionP_Type func_ptr2 = func_ptr;
49     return 0;
50 }

接下来是traits库的完整代码

// traits.hpp

#ifndef TRAITS_INCLUDE
#define TRAITS_INCLUDE

#include "function_traits.hpp"
#include "mfunction_traits.hpp"
#include "fun_to_mem_converter.hpp"
#include "mem_to_fun_converter.hpp"
#include "type_traits.hpp"
#include "pointer_integer_traits.hpp"

#endif
// traits_config.hpp
#ifndef TRAITS_CONFIG_INCLUDE
#define TRAITS_CONFIG_INCLUDE

#define NAMESPACE_TRAITS_BEGIN namespace traits{
#define NAMESPACE_TRAITS_END }

#endif
//type_traits.hpp

#ifndef TYPE_TRAITS_INCLUDE
#define TYPE_TRAITS_INCLUDE

#include "traits_config.hpp"

NAMESPACE_TRAITS_BEGIN

template<typename T>
struct type_traits
{
    typedef T         value_type;
    typedef const T   const_value_type;
    typedef T*        pointer_type;
    typedef const T*  const_pointer_type;
    typedef T**       pointer_pointer_type;
    typedef const T** const_pointer_pointer_type;
    typedef T&        reference_type;
    typedef const T&  const_reference_type;
    typedef T*&       pointer_reference_type;
    typedef const T*& const_pointer_reference_type;

    static bool is_reference(){return false;};
    static bool is_pointer(){return false;};
    static bool is_value(){return true;};
    static bool is_pointer_reference(){return false;}
    static bool is_pointer_pointer(){return false;}

    static bool is_const_reference(){return false;};
    static bool is_const_pointer(){return false;};
    static bool is_const_value(){return false;};
    static bool is_const_pointer_reference(){return false;}
    static bool is_const_pointer_pointer(){return false;}
};

template<typename T>
struct type_traits<const T> : public type_traits<T>
{
    static bool is_const_reference(){return false;};
    static bool is_const_pointer(){return false;};
    static bool is_const_value(){return true;};
    static bool is_const_pointer_reference(){return false;}
    static bool is_const_pointer_pointer(){return false;}
};

template<typename T>
struct type_traits<T*>: public type_traits<T>
{
    static bool is_reference(){return false;}
    static bool is_pointer(){return true;}
    static bool is_value(){return false;}
    static bool is_pointer_reference(){return false;}
    static bool is_pointer_pointer(){return false;}
};

template<typename T>
struct type_traits<const T*>: public type_traits<T*>
{
    static bool is_const_reference(){return false;};
    static bool is_const_pointer(){return true;};
    static bool is_const_value(){return false;};
    static bool is_const_pointer_reference(){return false;}
    static bool is_const_pointer_pointer(){return false;}
};

template<typename T>
struct type_traits<T&>: public type_traits<T>
{
    static bool is_reference(){return true;}
    static bool is_pointer(){return false;}
    static bool is_value(){return false;}
    static bool is_pointer_reference(){return false;}
    static bool is_pointer_pointer(){return false;}
};

template<typename T>
struct type_traits<const T&>: public type_traits<T&>
{
    static bool is_const_reference(){return true;};
    static bool is_const_pointer(){return false;};
    static bool is_const_value(){return false;};
    static bool is_const_pointer_reference(){return false;}
    static bool is_const_pointer_pointer(){return false;}
};

template<typename T>
struct type_traits<T**>: public type_traits<T>
{
    static bool is_reference(){return false;}
    static bool is_pointer(){return false;}
    static bool is_value(){return false;}
    static bool is_pointer_reference(){return false;}
    static bool is_pointer_pointer(){return true;}
};

template<typename T>
struct type_traits<const T**>: public type_traits<T**>
{
    static bool is_const_reference(){return false;};
    static bool is_const_pointer(){return false;};
    static bool is_const_value(){return false;};
    static bool is_const_pointer_reference(){return false;}
    static bool is_const_pointer_pointer(){return true;}
};

template<typename T>
struct type_traits<T*&>: public type_traits<T>
{
    static bool is_reference(){return false;}
    static bool is_pointer(){return false;}
    static bool is_value(){return false;}
    static bool is_pointer_reference(){return true;}
    static bool is_pointer_pointer(){return false;}
};

template<typename T>
struct type_traits<const T*&>: public type_traits<T*&>
{
    static bool is_const_reference(){return false;};
    static bool is_const_pointer(){return false;};
    static bool is_const_value(){return false;};
    static bool is_const_pointer_reference(){return true;}
    static bool is_const_pointer_pointer(){return false;}
};

template<typename T>
struct type_expand_traits
{
    typedef T value_type;
    typedef T& reference_type;
    typedef T* pointer_type;
    typedef const T const_value_type;
    typedef const T& const_reference_type;
    typedef const T* const_pointer_type;
};

template<typename T>
struct type_expand_traits<const T>
{
    typedef T value_type;
    typedef T& reference_type;
    typedef T* pointer_type;
    typedef const T const_value_type;
    typedef const T& const_reference_type;
    typedef const T* const_pointer_type;
};

template<typename T>
struct type_expand_traits<T*>
{
    typedef T* value_type;
    typedef T*& reference_type;
    typedef T** pointer_type;
    typedef const T* const_value_type;
    typedef const T*& const_reference_type;
    typedef const T** const_pointer_type;
};

template<typename T>
struct type_expand_traits<const T*>
{
    typedef T* value_type;
    typedef T*& reference_type;
    typedef T** pointer_type;
    typedef const T* const_value_type;
    typedef const T*& const_reference_type;
    typedef const T** const_pointer_type;
};

template<typename T>
struct type_expand_traits<T**>
{
    typedef T** value_type;
    typedef const T** const_value_type;
};

template<typename T>
struct type_expand_traits<const T**>
{
    typedef T** value_type;
    typedef const T** const_value_type;
};

template<typename T>
struct type_expand_traits<T&>
{
    typedef T value_type;
    typedef T& reference_type;
    typedef T* pointer_type;
    typedef const T const_value_type;
    typedef const T& const_reference_type;
    typedef const T* const_pointer_type;
};

template<typename T>
struct type_expand_traits<const T&>
{
    typedef T value_type;
    typedef T& reference_type;
    typedef T* pointer_type;
    typedef const T const_value_type;
    typedef const T& const_reference_type;
    typedef const T* const_pointer_type;
};

template<typename T>
struct type_expand_traits<T*&>
{
    typedef T* value_type;
    typedef T*& reference_type;
    typedef T** pointer_type;
    typedef const T* const_value_type;
    typedef const T*& const_reference_type;
    typedef const T** const_pointer_type;
};

template<typename T>
struct type_expand_traits<const T*&>
{
    typedef T* value_type;
    typedef T*& reference_type;
    typedef T** pointer_type;
    typedef const T* const_value_type;
    typedef const T*& const_reference_type;
    typedef const T** const_pointer_type;
};

NAMESPACE_TRAITS_END
#endif
//pointer_integer_traits.hpp

/*
函数地址与整数之间的转换
*/
#ifndef POINTER_INTEGER_TRAITS_INCLUDE
#define POINTER_INTEGER_TRAITS_INCLUDE

#include "traits_config.hpp"

NAMESPACE_TRAITS_BEGIN

// 指针与整数的转换
template<typename funp>
struct _pointer_integer_traits
{
protected:
    funp _fun;
    _pointer_integer_traits(unsigned int addr)
    {
        union
        {
            funp _fun;
            unsigned int _addr;
        }_u;
        _u._addr = addr;
        _fun = _u._fun;
    }
public:
    operator funp()
    {
        return _fun;
    }
};

template<>
struct _pointer_integer_traits<unsigned int>
{
protected:
    unsigned int _addr;
    template<typename funp>
    _pointer_integer_traits(funp fun)
    {
        union
        {
            funp _fun;
            unsigned int _addr;
        }_u;
        _u._fun = fun;
        _addr = _u._addr;
    }
public:
    operator unsigned int()
    {
        return _addr;
    }
};

template<typename funp>
struct pointer_integer_traits : public _pointer_integer_traits<funp>
{
    pointer_integer_traits(const unsigned int addr):_pointer_integer_traits<funp>(addr){}
};

template<typename funp>
struct pointer_integer_traits<const funp*> : public _pointer_integer_traits<funp>
{
    pointer_integer_traits(const unsigned int addr):_pointer_integer_traits<funp>(addr){}
};

template<>
struct pointer_integer_traits<int> : public _pointer_integer_traits<unsigned int>
{
    template<typename funp>
    pointer_integer_traits(funp fun):_pointer_integer_traits<unsigned int>(fun){}

    template<typename funp>
    pointer_integer_traits(const funp* fun):_pointer_integer_traits<unsigned int>(fun){}
};

template<>
struct pointer_integer_traits<unsigned int> : public _pointer_integer_traits<unsigned int>
{
    template<typename funp>
    pointer_integer_traits(funp fun):_pointer_integer_traits<unsigned int>(fun){}

    template<typename funp>
    pointer_integer_traits(const funp* fun):_pointer_integer_traits<unsigned int>(fun){}
};

//////////////////////////////////////////

// 指针与引用的换
template<typename T>
struct pointer_reference_traits;

template<typename T>
struct pointer_reference_traits<T&>
{
    T* _p;
    pointer_reference_traits(const T* p)
    {
        _p = const_cast<T*>(p);
    }
    operator T&(){return *_p;}
};

template<typename T>
struct pointer_reference_traits<const T&>
{
    T* _p;
    pointer_reference_traits(const T* p)
    {
        _p = const_cast<T*>(p);
    }
    operator const T&(){return *_p;}
};

template<typename T>
struct pointer_reference_traits<T*>
{
    T* _p;
    pointer_reference_traits(const T& p)
    {
        _p = const_cast<T*>(&p);
    }
    operator T*(){return _p;}
};

template<typename T>
struct pointer_reference_traits<const T*>
{
    T* _p;
    pointer_reference_traits(const T& p)
    {
        _p = const_cast<T*>(&p);
    }
    operator const T*(){return _p;}
};

/////////////////////////////////

NAMESPACE_TRAITS_END
#endif
// mfunction_traits.hpp

#ifndef MFUNCTION_TRAITS_INCLUDE
#define MFUNCTION_TRAITS_INCLUDE

#include "traits_config.hpp"

NAMESPACE_TRAITS_BEGIN

template<typename Function> struct mfunction_traits_helper;

template<typename Classtype,typename R>
struct mfunction_traits_helper<R(Classtype::*)()>
{
    enum{arity = 0};
    typedef R result_type;
    typedef Classtype class_type;
};

template<typename Classtype,typename R,typename Arg1>
struct mfunction_traits_helper<R(Classtype::*)(Arg1)>
{
    typedef Arg1 arg1;

    enum{arity = 1};
    typedef R result_type;
    typedef Classtype class_type;
};

template<typename Classtype,typename R,typename Arg2,typename Arg1>
struct mfunction_traits_helper<R(Classtype::*)(Arg2,Arg1)>
{
    typedef Arg2 arg2;
    typedef Arg1 arg1;

    enum{arity = 2};
    typedef R result_type;
    typedef Classtype class_type;
};

template<typename Classtype,typename R,typename Arg3,typename Arg2,typename Arg1>
struct mfunction_traits_helper<R(Classtype::*)(Arg3,Arg2,Arg1)>
{
    typedef Arg3 arg3;
    typedef Arg2 arg2;
    typedef Arg1 arg1;

    enum{arity = 3};
    typedef R result_type;
    typedef Classtype class_type;
};

template<typename Classtype,typename R,typename Arg4,typename Arg3,typename Arg2,typename Arg1>
struct mfunction_traits_helper<R(Classtype::*)(Arg4,Arg3,Arg2,Arg1)>
{
    typedef Arg4 arg4;
    typedef Arg3 arg3;
    typedef Arg2 arg2;
    typedef Arg1 arg1;

    enum{arity = 4};
    typedef R result_type;
    typedef Classtype class_type;
};

template<typename Classtype,typename R,typename Arg5,typename Arg4,typename Arg3,typename Arg2,typename Arg1>
struct mfunction_traits_helper<R(Classtype::*)(Arg5,Arg4,Arg3,Arg2,Arg1)>
{
    typedef Arg5 arg5;
    typedef Arg4 arg4;
    typedef Arg3 arg3;
    typedef Arg2 arg2;
    typedef Arg1 arg1;

    enum{arity = 5};
    typedef R result_type;
    typedef Classtype class_type;
};

template<typename Classtype,typename R,typename Arg6,typename Arg5,typename Arg4,typename Arg3,typename Arg2,typename Arg1>
struct mfunction_traits_helper<R(Classtype::*)(Arg6,Arg5,Arg4,Arg3,Arg2,Arg1)>
{
    typedef Arg6 arg6;
    typedef Arg5 arg5;
    typedef Arg4 arg4;
    typedef Arg3 arg3;
    typedef Arg2 arg2;
    typedef Arg1 arg1;

    enum{arity = 6};
    typedef R result_type;
    typedef Classtype class_type;
};

template<typename Classtype,typename R,typename Arg7,typename Arg6,typename Arg5,typename Arg4,typename Arg3,typename Arg2,typename Arg1>
struct mfunction_traits_helper<R(Classtype::*)(Arg7,Arg6,Arg5,Arg4,Arg3,Arg2,Arg1)>
{
    typedef Arg7 arg7;
    typedef Arg6 arg6;
    typedef Arg5 arg5;
    typedef Arg4 arg4;
    typedef Arg3 arg3;
    typedef Arg2 arg2;
    typedef Arg1 arg1;

    enum{arity = 7};
    typedef R result_type;
    typedef Classtype class_type;
};

template<typename Classtype,typename R,typename Arg8,typename Arg7,typename Arg6,typename Arg5,typename Arg4,typename Arg3,typename Arg2,typename Arg1>
struct mfunction_traits_helper<R(Classtype::*)(Arg8,Arg7,Arg6,Arg5,Arg4,Arg3,Arg2,Arg1)>
{
    typedef Arg8 arg8;
    typedef Arg7 arg7;
    typedef Arg6 arg6;
    typedef Arg5 arg5;
    typedef Arg4 arg4;
    typedef Arg3 arg3;
    typedef Arg2 arg2;
    typedef Arg1 arg1;

    enum{arity = 8};
    typedef R result_type;
    typedef Classtype class_type;
};

template<typename Classtype,typename R,
    typename Arg9,
    typename Arg8,typename Arg7,typename Arg6,typename Arg5,typename Arg4,typename Arg3,typename Arg2,typename Arg1>
struct mfunction_traits_helper<R(Classtype::*)(Arg9,Arg8,Arg7,Arg6,Arg5,Arg4,Arg3,Arg2,Arg1)>
{
    typedef Arg9 arg9;
    typedef Arg8 arg8;
    typedef Arg7 arg7;
    typedef Arg6 arg6;
    typedef Arg5 arg5;
    typedef Arg4 arg4;
    typedef Arg3 arg3;
    typedef Arg2 arg2;
    typedef Arg1 arg1;

    enum{arity = 9};
    typedef R result_type;
    typedef Classtype class_type;
};

template<typename Classtype,typename R,
    typename Arg10,
    typename Arg9,
    typename Arg8,typename Arg7,typename Arg6,typename Arg5,typename Arg4,typename Arg3,typename Arg2,typename Arg1>
struct mfunction_traits_helper<R(Classtype::*)(Arg10,Arg9,Arg8,Arg7,Arg6,Arg5,Arg4,Arg3,Arg2,Arg1)>
{
    typedef Arg10 arg10;
    typedef Arg9 arg9;
    typedef Arg8 arg8;
    typedef Arg7 arg7;
    typedef Arg6 arg6;
    typedef Arg5 arg5;
    typedef Arg4 arg4;
    typedef Arg3 arg3;
    typedef Arg2 arg2;
    typedef Arg1 arg1;

    enum{arity = 10};
    typedef R result_type;
    typedef Classtype class_type;
};

template<typename Classtype,typename R,
    typename Arg11,
    typename Arg10,
    typename Arg9,
    typename Arg8,typename Arg7,typename Arg6,typename Arg5,typename Arg4,typename Arg3,typename Arg2,typename Arg1>
struct mfunction_traits_helper<R(Classtype::*)(Arg11,Arg10,Arg9,Arg8,Arg7,Arg6,Arg5,Arg4,Arg3,Arg2,Arg1)>
{
    typedef Arg11 arg11;
    typedef Arg10 arg10;
    typedef Arg9 arg9;
    typedef Arg8 arg8;
    typedef Arg7 arg7;
    typedef Arg6 arg6;
    typedef Arg5 arg5;
    typedef Arg4 arg4;
    typedef Arg3 arg3;
    typedef Arg2 arg2;
    typedef Arg1 arg1;

    enum{arity = 11};
    typedef R result_type;
    typedef Classtype class_type;
};

template<typename Classtype,typename R,
    typename Arg12,
    typename Arg11,
    typename Arg10,
    typename Arg9,
    typename Arg8,typename Arg7,typename Arg6,typename Arg5,typename Arg4,typename Arg3,typename Arg2,typename Arg1>
struct mfunction_traits_helper<R(Classtype::*)(Arg12,Arg11,Arg10,Arg9,Arg8,Arg7,Arg6,Arg5,Arg4,Arg3,Arg2,Arg1)>
{
    typedef Arg11 arg11;
    typedef Arg10 arg10;
    typedef Arg9 arg9;
    typedef Arg8 arg8;
    typedef Arg7 arg7;
    typedef Arg6 arg6;
    typedef Arg5 arg5;
    typedef Arg4 arg4;
    typedef Arg3 arg3;
    typedef Arg2 arg2;
    typedef Arg1 arg1;

    enum{arity = 12};
    typedef R result_type;
    typedef Classtype class_type;
};

template<typename Classtype,typename R,
    typename Arg13,
    typename Arg12,
    typename Arg11,
    typename Arg10,
    typename Arg9,
    typename Arg8,typename Arg7,typename Arg6,typename Arg5,typename Arg4,typename Arg3,typename Arg2,typename Arg1>
struct mfunction_traits_helper<R(Classtype::*)(Arg13,Arg12,Arg11,Arg10,Arg9,Arg8,Arg7,Arg6,Arg5,Arg4,Arg3,Arg2,Arg1)>
{
    typedef Arg13 arg13;
    typedef Arg11 arg11;
    typedef Arg10 arg10;
    typedef Arg9 arg9;
    typedef Arg8 arg8;
    typedef Arg7 arg7;
    typedef Arg6 arg6;
    typedef Arg5 arg5;
    typedef Arg4 arg4;
    typedef Arg3 arg3;
    typedef Arg2 arg2;
    typedef Arg1 arg1;

    enum{arity = 13};
    typedef R result_type;
    typedef Classtype class_type;
};

template<typename Classtype,typename R,
    typename Arg14,
    typename Arg13,
    typename Arg12,
    typename Arg11,
    typename Arg10,
    typename Arg9,
    typename Arg8,typename Arg7,typename Arg6,typename Arg5,typename Arg4,typename Arg3,typename Arg2,typename Arg1>
struct mfunction_traits_helper<R(Classtype::*)(Arg14,Arg13,Arg12,Arg11,Arg10,Arg9,Arg8,Arg7,Arg6,Arg5,Arg4,Arg3,Arg2,Arg1)>
{
    typedef Arg14 arg14;
    typedef Arg13 arg13;
    typedef Arg11 arg11;
    typedef Arg10 arg10;
    typedef Arg9 arg9;
    typedef Arg8 arg8;
    typedef Arg7 arg7;
    typedef Arg6 arg6;
    typedef Arg5 arg5;
    typedef Arg4 arg4;
    typedef Arg3 arg3;
    typedef Arg2 arg2;
    typedef Arg1 arg1;

    enum{arity = 14};
    typedef R result_type;
    typedef Classtype class_type;
};

template<typename Classtype,typename R,
    typename Arg15,
    typename Arg14,
    typename Arg13,
    typename Arg12,
    typename Arg11,
    typename Arg10,
    typename Arg9,
    typename Arg8,typename Arg7,typename Arg6,typename Arg5,typename Arg4,typename Arg3,typename Arg2,typename Arg1>
struct mfunction_traits_helper<R(Classtype::*)(Arg15,Arg14,Arg13,Arg12,Arg11,Arg10,Arg9,Arg8,Arg7,Arg6,Arg5,Arg4,Arg3,Arg2,Arg1)>
{
    typedef Arg15 arg15;
    typedef Arg14 arg14;
    typedef Arg13 arg13;
    typedef Arg11 arg11;
    typedef Arg10 arg10;
    typedef Arg9 arg9;
    typedef Arg8 arg8;
    typedef Arg7 arg7;
    typedef Arg6 arg6;
    typedef Arg5 arg5;
    typedef Arg4 arg4;
    typedef Arg3 arg3;
    typedef Arg2 arg2;
    typedef Arg1 arg1;

    enum{arity = 15};
    typedef R result_type;
    typedef Classtype class_type;
};

template<typename Classtype,typename R,
    typename Arg16,
    typename Arg15,
    typename Arg14,
    typename Arg13,
    typename Arg12,
    typename Arg11,
    typename Arg10,
    typename Arg9,
    typename Arg8,typename Arg7,typename Arg6,typename Arg5,typename Arg4,typename Arg3,typename Arg2,typename Arg1>
struct mfunction_traits_helper<R(Classtype::*)(Arg16,Arg15,Arg14,Arg13,Arg12,Arg11,Arg10,Arg9,Arg8,Arg7,Arg6,Arg5,Arg4,Arg3,Arg2,Arg1)>
{
    typedef Arg16 arg16;
    typedef Arg15 arg15;
    typedef Arg14 arg14;
    typedef Arg13 arg13;
    typedef Arg11 arg11;
    typedef Arg10 arg10;
    typedef Arg9 arg9;
    typedef Arg8 arg8;
    typedef Arg7 arg7;
    typedef Arg6 arg6;
    typedef Arg5 arg5;
    typedef Arg4 arg4;
    typedef Arg3 arg3;
    typedef Arg2 arg2;
    typedef Arg1 arg1;

    enum{arity = 16};
    typedef R result_type;
    typedef Classtype class_type;
};

template<typename Classtype,typename R,
    typename Arg17,
    typename Arg16,
    typename Arg15,
    typename Arg14,
    typename Arg13,
    typename Arg12,
    typename Arg11,
    typename Arg10,
    typename Arg9,
    typename Arg8,typename Arg7,typename Arg6,typename Arg5,typename Arg4,typename Arg3,typename Arg2,typename Arg1>
struct mfunction_traits_helper<R(Classtype::*)(Arg17,Arg16,Arg15,Arg14,Arg13,Arg12,Arg11,Arg10,Arg9,Arg8,Arg7,Arg6,Arg5,Arg4,Arg3,Arg2,Arg1)>
{
    typedef Arg17 arg17;
    typedef Arg16 arg16;
    typedef Arg15 arg15;
    typedef Arg14 arg14;
    typedef Arg13 arg13;
    typedef Arg11 arg11;
    typedef Arg10 arg10;
    typedef Arg9 arg9;
    typedef Arg8 arg8;
    typedef Arg7 arg7;
    typedef Arg6 arg6;
    typedef Arg5 arg5;
    typedef Arg4 arg4;
    typedef Arg3 arg3;
    typedef Arg2 arg2;
    typedef Arg1 arg1;

    enum{arity = 17};
    typedef R result_type;
    typedef Classtype class_type;
};

template<typename Classtype,typename R,
    typename Arg18,
    typename Arg17,
    typename Arg16,
    typename Arg15,
    typename Arg14,
    typename Arg13,
    typename Arg12,
    typename Arg11,
    typename Arg10,
    typename Arg9,
    typename Arg8,typename Arg7,typename Arg6,typename Arg5,typename Arg4,typename Arg3,typename Arg2,typename Arg1>
struct mfunction_traits_helper<R(Classtype::*)(Arg18,Arg17,Arg16,Arg15,Arg14,Arg13,Arg12,Arg11,Arg10,Arg9,Arg8,Arg7,Arg6,Arg5,Arg4,Arg3,Arg2,Arg1)>
{
    typedef Arg18 arg18;
    typedef Arg17 arg17;
    typedef Arg16 arg16;
    typedef Arg15 arg15;
    typedef Arg14 arg14;
    typedef Arg13 arg13;
    typedef Arg11 arg11;
    typedef Arg10 arg10;
    typedef Arg9 arg9;
    typedef Arg8 arg8;
    typedef Arg7 arg7;
    typedef Arg6 arg6;
    typedef Arg5 arg5;
    typedef Arg4 arg4;
    typedef Arg3 arg3;
    typedef Arg2 arg2;
    typedef Arg1 arg1;

    enum{arity = 18};
    typedef R result_type;
    typedef Classtype class_type;
};

template<typename Classtype,typename R,
    typename Arg19,
    typename Arg18,
    typename Arg17,
    typename Arg16,
    typename Arg15,
    typename Arg14,
    typename Arg13,
    typename Arg12,
    typename Arg11,
    typename Arg10,
    typename Arg9,
    typename Arg8,typename Arg7,typename Arg6,typename Arg5,typename Arg4,typename Arg3,typename Arg2,typename Arg1>
struct mfunction_traits_helper<R(Classtype::*)(Arg19,Arg18,Arg17,Arg16,Arg15,Arg14,Arg13,Arg12,Arg11,Arg10,Arg9,Arg8,Arg7,Arg6,Arg5,Arg4,Arg3,Arg2,Arg1)>
{
    typedef Arg19 arg19;
    typedef Arg18 arg18;
    typedef Arg17 arg17;
    typedef Arg16 arg16;
    typedef Arg15 arg15;
    typedef Arg14 arg14;
    typedef Arg13 arg13;
    typedef Arg11 arg11;
    typedef Arg10 arg10;
    typedef Arg9 arg9;
    typedef Arg8 arg8;
    typedef Arg7 arg7;
    typedef Arg6 arg6;
    typedef Arg5 arg5;
    typedef Arg4 arg4;
    typedef Arg3 arg3;
    typedef Arg2 arg2;
    typedef Arg1 arg1;

    enum{arity = 19};
    typedef R result_type;
    typedef Classtype class_type;
};

template<typename Classtype,typename R,
    typename Arg20,
    typename Arg19,
    typename Arg18,
    typename Arg17,
    typename Arg16,
    typename Arg15,
    typename Arg14,
    typename Arg13,
    typename Arg12,
    typename Arg11,
    typename Arg10,
    typename Arg9,
    typename Arg8,typename Arg7,typename Arg6,typename Arg5,typename Arg4,typename Arg3,typename Arg2,typename Arg1>
struct mfunction_traits_helper<R(Classtype::*)(Arg20,Arg19,Arg18,Arg17,Arg16,Arg15,Arg14,Arg13,Arg12,Arg11,Arg10,Arg9,Arg8,Arg7,Arg6,Arg5,Arg4,Arg3,Arg2,Arg1)>
{
    typedef Arg20 arg20;
    typedef Arg19 arg19;
    typedef Arg18 arg18;
    typedef Arg17 arg17;
    typedef Arg16 arg16;
    typedef Arg15 arg15;
    typedef Arg14 arg14;
    typedef Arg13 arg13;
    typedef Arg11 arg11;
    typedef Arg10 arg10;
    typedef Arg9 arg9;
    typedef Arg8 arg8;
    typedef Arg7 arg7;
    typedef Arg6 arg6;
    typedef Arg5 arg5;
    typedef Arg4 arg4;
    typedef Arg3 arg3;
    typedef Arg2 arg2;
    typedef Arg1 arg1;

    enum{arity = 20};
    typedef R result_type;
    typedef Classtype class_type;
};

template<typename _MFunctionP_Type>
struct mfunction_traits : public mfunction_traits_helper<_MFunctionP_Type>
{
    typedef _MFunctionP_Type MFunctionP_Type;
};

NAMESPACE_TRAITS_END
#endif
//mem_to_fun_converter.hpp

#ifndef MEM_TO_FUN_CONVERTER_INCLUDE
#define MEM_TO_FUN_CONVERTER_INCLUDE

/*@brief:
    换成员函数指针类型转为普通函数类型*/

#include "traits_config.hpp"
#include "mfunction_traits.hpp"

NAMESPACE_TRAITS_BEGIN

template<int Arity, typename funtype>
struct mem_to_fun_converter_helper;

template<typename funtype>
struct mem_to_fun_converter_helper<0,funtype>
{
    typedef mfunction_traits<funtype> _traits;

    typedef typename _traits::result_type(*FunctionP_Type)();
};

template<typename funtype>
struct mem_to_fun_converter_helper<1,funtype>
{
    typedef mfunction_traits<funtype> _traits;

    typedef typename _traits::result_type(*FunctionP_Type)(typename _traits::arg1);
};

template<typename funtype>
struct mem_to_fun_converter_helper<2,funtype>
{
    typedef mfunction_traits<funtype> _traits;

    typedef typename _traits::result_type(*FunctionP_Type)(typename _traits::arg2,typename _traits::arg1);
};

template<typename funtype>
struct mem_to_fun_converter_helper<3,funtype>
{
    typedef mfunction_traits<funtype> _traits;

    typedef typename _traits::result_type(*FunctionP_Type)(typename _traits::arg3,typename _traits::arg2,typename _traits::arg1);
};

template<typename funtype>
struct mem_to_fun_converter_helper<4,funtype>
{
    typedef mfunction_traits<funtype> _traits;

    typedef
        typename _traits::result_type(*FunctionP_Type)
        (
        typename _traits::arg4,
        typename _traits::arg3,
        typename _traits::arg2,
        typename _traits::arg1);
};

template<typename funtype>
struct mem_to_fun_converter_helper<5,funtype>
{
    typedef mfunction_traits<funtype> _traits;

    typedef
        typename _traits::result_type(*FunctionP_Type)
        (
        typename _traits::arg5,
        typename _traits::arg4,
        typename _traits::arg3,
        typename _traits::arg2,
        typename _traits::arg1);
};

template<typename funtype>
struct mem_to_fun_converter_helper<6,funtype>
{
    typedef mfunction_traits<funtype> _traits;

    typedef
        typename _traits::result_type(*FunctionP_Type)
        (
        typename _traits::arg6,
        typename _traits::arg5,
        typename _traits::arg4,
        typename _traits::arg3,
        typename _traits::arg2,
        typename _traits::arg1);
};

template<typename funtype>
struct mem_to_fun_converter_helper<7,funtype>
{
    typedef mfunction_traits<funtype> _traits;

    typedef
        typename _traits::result_type(*FunctionP_Type)
        (
        typename _traits::arg7,
        typename _traits::arg6,
        typename _traits::arg5,
        typename _traits::arg4,
        typename _traits::arg3,
        typename _traits::arg2,
        typename _traits::arg1);
};

template<typename funtype>
struct mem_to_fun_converter_helper<8,funtype>
{
    typedef mfunction_traits<funtype> _traits;

    typedef
        typename _traits::result_type(*FunctionP_Type)
        (
        typename _traits::arg8,
        typename _traits::arg7,
        typename _traits::arg6,
        typename _traits::arg5,
        typename _traits::arg4,
        typename _traits::arg3,
        typename _traits::arg2,
        typename _traits::arg1);
};

template<typename funtype>
struct mem_to_fun_converter_helper<9,funtype>
{
    typedef mfunction_traits<funtype> _traits;

    typedef
        typename _traits::result_type(*FunctionP_Type)
        (
        typename _traits::arg9,
        typename _traits::arg8,
        typename _traits::arg7,
        typename _traits::arg6,
        typename _traits::arg5,
        typename _traits::arg4,
        typename _traits::arg3,
        typename _traits::arg2,
        typename _traits::arg1);
};

template<typename funtype>
struct mem_to_fun_converter_helper<10,funtype>
{
    typedef mfunction_traits<funtype> _traits;

    typedef
        typename _traits::result_type(*FunctionP_Type)
        (
        typename _traits::arg10,
        typename _traits::arg9,
        typename _traits::arg8,
        typename _traits::arg7,
        typename _traits::arg6,
        typename _traits::arg5,
        typename _traits::arg4,
        typename _traits::arg3,
        typename _traits::arg2,
        typename _traits::arg1);
};

template<typename funtype>
struct mem_to_fun_converter_helper<11,funtype>
{
    typedef mfunction_traits<funtype> _traits;

    typedef
        typename _traits::result_type(*FunctionP_Type)
        (
        typename _traits::arg11,
        typename _traits::arg10,
        typename _traits::arg9,
        typename _traits::arg8,
        typename _traits::arg7,
        typename _traits::arg6,
        typename _traits::arg5,
        typename _traits::arg4,
        typename _traits::arg3,
        typename _traits::arg2,
        typename _traits::arg1);
};

template<typename funtype>
struct mem_to_fun_converter_helper<12,funtype>
{
    typedef mfunction_traits<funtype> _traits;

    typedef
        typename _traits::result_type(*FunctionP_Type)
        (
        typename _traits::arg12,
        typename _traits::arg11,
        typename _traits::arg10,
        typename _traits::arg9,
        typename _traits::arg8,
        typename _traits::arg7,
        typename _traits::arg6,
        typename _traits::arg5,
        typename _traits::arg4,
        typename _traits::arg3,
        typename _traits::arg2,
        typename _traits::arg1);
};

template<typename funtype>
struct mem_to_fun_converter_helper<13,funtype>
{
    typedef mfunction_traits<funtype> _traits;

    typedef
        typename _traits::result_type(*FunctionP_Type)
        (
        typename _traits::arg13,
        typename _traits::arg12,
        typename _traits::arg11,
        typename _traits::arg10,
        typename _traits::arg9,
        typename _traits::arg8,
        typename _traits::arg7,
        typename _traits::arg6,
        typename _traits::arg5,
        typename _traits::arg4,
        typename _traits::arg3,
        typename _traits::arg2,
        typename _traits::arg1);
};

template<typename funtype>
struct mem_to_fun_converter_helper<14,funtype>
{
    typedef mfunction_traits<funtype> _traits;

    typedef
        typename _traits::result_type(*FunctionP_Type)
        (
        typename _traits::arg14,
        typename _traits::arg13,
        typename _traits::arg12,
        typename _traits::arg11,
        typename _traits::arg10,
        typename _traits::arg9,
        typename _traits::arg8,
        typename _traits::arg7,
        typename _traits::arg6,
        typename _traits::arg5,
        typename _traits::arg4,
        typename _traits::arg3,
        typename _traits::arg2,
        typename _traits::arg1);
};

template<typename funtype>
struct mem_to_fun_converter_helper<15,funtype>
{
    typedef mfunction_traits<funtype> _traits;

    typedef
        typename _traits::result_type(*FunctionP_Type)
        (
        typename _traits::arg15,
        typename _traits::arg14,
        typename _traits::arg13,
        typename _traits::arg12,
        typename _traits::arg11,
        typename _traits::arg10,
        typename _traits::arg9,
        typename _traits::arg8,
        typename _traits::arg7,
        typename _traits::arg6,
        typename _traits::arg5,
        typename _traits::arg4,
        typename _traits::arg3,
        typename _traits::arg2,
        typename _traits::arg1);
};

template<typename funtype>
struct mem_to_fun_converter_helper<16,funtype>
{
    typedef mfunction_traits<funtype> _traits;

    typedef
        typename _traits::result_type(*FunctionP_Type)
        (
        typename _traits::arg16,
        typename _traits::arg15,
        typename _traits::arg14,
        typename _traits::arg13,
        typename _traits::arg12,
        typename _traits::arg11,
        typename _traits::arg10,
        typename _traits::arg9,
        typename _traits::arg8,
        typename _traits::arg7,
        typename _traits::arg6,
        typename _traits::arg5,
        typename _traits::arg4,
        typename _traits::arg3,
        typename _traits::arg2,
        typename _traits::arg1);
};

template<typename funtype>
struct mem_to_fun_converter_helper<17,funtype>
{
    typedef mfunction_traits<funtype> _traits;

    typedef
        typename _traits::result_type(*FunctionP_Type)
        (
        typename _traits::arg17,
        typename _traits::arg16,
        typename _traits::arg15,
        typename _traits::arg14,
        typename _traits::arg13,
        typename _traits::arg12,
        typename _traits::arg11,
        typename _traits::arg10,
        typename _traits::arg9,
        typename _traits::arg8,
        typename _traits::arg7,
        typename _traits::arg6,
        typename _traits::arg5,
        typename _traits::arg4,
        typename _traits::arg3,
        typename _traits::arg2,
        typename _traits::arg1);
};

template<typename funtype>
struct mem_to_fun_converter_helper<18,funtype>
{
    typedef mfunction_traits<funtype> _traits;

    typedef
        typename _traits::result_type(*FunctionP_Type)
        (
        typename _traits::arg18,
        typename _traits::arg17,
        typename _traits::arg16,
        typename _traits::arg15,
        typename _traits::arg14,
        typename _traits::arg13,
        typename _traits::arg12,
        typename _traits::arg11,
        typename _traits::arg10,
        typename _traits::arg9,
        typename _traits::arg8,
        typename _traits::arg7,
        typename _traits::arg6,
        typename _traits::arg5,
        typename _traits::arg4,
        typename _traits::arg3,
        typename _traits::arg2,
        typename _traits::arg1);
};

template<typename funtype>
struct mem_to_fun_converter_helper<19,funtype>
{
    typedef mfunction_traits<funtype> _traits;

    typedef
        typename _traits::result_type(*FunctionP_Type)
        (
        typename _traits::arg19,
        typename _traits::arg18,
        typename _traits::arg17,
        typename _traits::arg16,
        typename _traits::arg15,
        typename _traits::arg14,
        typename _traits::arg13,
        typename _traits::arg12,
        typename _traits::arg11,
        typename _traits::arg10,
        typename _traits::arg9,
        typename _traits::arg8,
        typename _traits::arg7,
        typename _traits::arg6,
        typename _traits::arg5,
        typename _traits::arg4,
        typename _traits::arg3,
        typename _traits::arg2,
        typename _traits::arg1);
};

template<typename funtype>
struct mem_to_fun_converter_helper<20,funtype>
{
    typedef mfunction_traits<funtype> _traits;

    typedef
        typename _traits::result_type(*FunctionP_Type)
        (
        typename _traits::arg20,
        typename _traits::arg19,
        typename _traits::arg18,
        typename _traits::arg17,
        typename _traits::arg16,
        typename _traits::arg15,
        typename _traits::arg14,
        typename _traits::arg13,
        typename _traits::arg12,
        typename _traits::arg11,
        typename _traits::arg10,
        typename _traits::arg9,
        typename _traits::arg8,
        typename _traits::arg7,
        typename _traits::arg6,
        typename _traits::arg5,
        typename _traits::arg4,
        typename _traits::arg3,
        typename _traits::arg2,
        typename _traits::arg1);
};

template<typename Signature>
struct mem_to_fun_converter
{
    typedef
        typename mem_to_fun_converter_helper<mfunction_traits<Signature>::arity,Signature>::FunctionP_Type
    FunctionP_Type;
};

NAMESPACE_TRAITS_END
#endif
// function_traits.hpp

#ifndef FUNCTION_TRAITS_INCLUDE
#define FUNCTION_TRAITS_INCLUDE

#include "traits_config.hpp"

NAMESPACE_TRAITS_BEGIN

template<typename Function>
struct function_pointer_traits
{
    typedef Function* FunctionP_Type;
    typedef Function  Function_Type;
};

template<typename Function>
struct function_pointer_traits<Function*>
{
    typedef Function* FunctionP_Type;
    typedef Function  Function_Type;
};

template<typename Function> struct function_traits_helper;

template<typename R>
struct function_traits_helper<R(*)()>
{
    enum{arity = 0};
    typedef R result_type;
};

template<typename R,typename Arg1>
struct function_traits_helper<R(*)(Arg1)>
{
    typedef Arg1 arg1;

    enum{arity = 1};
    typedef R result_type;
};

template<typename R,typename Arg2,typename Arg1>
struct function_traits_helper<R(*)(Arg2,Arg1)>
{
    typedef Arg2 arg2;
    typedef Arg1 arg1;

    enum{arity = 2};
    typedef R result_type;
};

template<typename R,typename Arg3,typename Arg2,typename Arg1>
struct function_traits_helper<R(*)(Arg3,Arg2,Arg1)>
{
    typedef Arg3 arg3;
    typedef Arg2 arg2;
    typedef Arg1 arg1;

    enum{arity = 3};
    typedef R result_type;
};

template<typename R,typename Arg4,typename Arg3,typename Arg2,typename Arg1>
struct function_traits_helper<R(*)(Arg4,Arg3,Arg2,Arg1)>
{
    typedef Arg4 arg4;
    typedef Arg3 arg3;
    typedef Arg2 arg2;
    typedef Arg1 arg1;

    enum{arity = 4};
    typedef R result_type;
};

template<typename R,typename Arg5,typename Arg4,typename Arg3,typename Arg2,typename Arg1>
struct function_traits_helper<R(*)(Arg5,Arg4,Arg3,Arg2,Arg1)>
{
    typedef Arg5 arg5;
    typedef Arg4 arg4;
    typedef Arg3 arg3;
    typedef Arg2 arg2;
    typedef Arg1 arg1;

    enum{arity = 5};
    typedef R result_type;
};

template<typename R,typename Arg6,typename Arg5,typename Arg4,typename Arg3,typename Arg2,typename Arg1>
struct function_traits_helper<R(*)(Arg6,Arg5,Arg4,Arg3,Arg2,Arg1)>
{
    typedef Arg6 arg6;
    typedef Arg5 arg5;
    typedef Arg4 arg4;
    typedef Arg3 arg3;
    typedef Arg2 arg2;
    typedef Arg1 arg1;

    enum{arity = 6};
    typedef R result_type;
};

template<typename R,typename Arg7,typename Arg6,typename Arg5,typename Arg4,typename Arg3,typename Arg2,typename Arg1>
struct function_traits_helper<R(*)(Arg7,Arg6,Arg5,Arg4,Arg3,Arg2,Arg1)>
{
    typedef Arg7 arg7;
    typedef Arg6 arg6;
    typedef Arg5 arg5;
    typedef Arg4 arg4;
    typedef Arg3 arg3;
    typedef Arg2 arg2;
    typedef Arg1 arg1;

    enum{arity = 7};
    typedef R result_type;
};

template<typename R,typename Arg8,typename Arg7,typename Arg6,typename Arg5,typename Arg4,typename Arg3,typename Arg2,typename Arg1>
struct function_traits_helper<R(*)(Arg8,Arg7,Arg6,Arg5,Arg4,Arg3,Arg2,Arg1)>
{
    typedef Arg8 arg8;
    typedef Arg7 arg7;
    typedef Arg6 arg6;
    typedef Arg5 arg5;
    typedef Arg4 arg4;
    typedef Arg3 arg3;
    typedef Arg2 arg2;
    typedef Arg1 arg1;

    enum{arity = 8};
    typedef R result_type;
};

template<typename R,
    typename Arg9,
    typename Arg8,typename Arg7,typename Arg6,typename Arg5,typename Arg4,typename Arg3,typename Arg2,typename Arg1>
struct function_traits_helper<R(*)(Arg9,Arg8,Arg7,Arg6,Arg5,Arg4,Arg3,Arg2,Arg1)>
{
    typedef Arg9 arg9;
    typedef Arg8 arg8;
    typedef Arg7 arg7;
    typedef Arg6 arg6;
    typedef Arg5 arg5;
    typedef Arg4 arg4;
    typedef Arg3 arg3;
    typedef Arg2 arg2;
    typedef Arg1 arg1;

    enum{arity = 9};
    typedef R result_type;
};

template<typename R,
    typename Arg10,
    typename Arg9,
    typename Arg8,typename Arg7,typename Arg6,typename Arg5,typename Arg4,typename Arg3,typename Arg2,typename Arg1>
struct function_traits_helper<R(*)(Arg10,Arg9,Arg8,Arg7,Arg6,Arg5,Arg4,Arg3,Arg2,Arg1)>
{
    typedef Arg10 arg10;
    typedef Arg9 arg9;
    typedef Arg8 arg8;
    typedef Arg7 arg7;
    typedef Arg6 arg6;
    typedef Arg5 arg5;
    typedef Arg4 arg4;
    typedef Arg3 arg3;
    typedef Arg2 arg2;
    typedef Arg1 arg1;

    enum{arity = 10};
    typedef R result_type;
};

template<typename R,
    typename Arg11,
    typename Arg10,
    typename Arg9,
    typename Arg8,typename Arg7,typename Arg6,typename Arg5,typename Arg4,typename Arg3,typename Arg2,typename Arg1>
struct function_traits_helper<R(*)(Arg11,Arg10,Arg9,Arg8,Arg7,Arg6,Arg5,Arg4,Arg3,Arg2,Arg1)>
{
    typedef Arg11 arg11;
    typedef Arg10 arg10;
    typedef Arg9 arg9;
    typedef Arg8 arg8;
    typedef Arg7 arg7;
    typedef Arg6 arg6;
    typedef Arg5 arg5;
    typedef Arg4 arg4;
    typedef Arg3 arg3;
    typedef Arg2 arg2;
    typedef Arg1 arg1;

    enum{arity = 11};
    typedef R result_type;
};

template<typename R,
    typename Arg12,
    typename Arg11,
    typename Arg10,
    typename Arg9,
    typename Arg8,typename Arg7,typename Arg6,typename Arg5,typename Arg4,typename Arg3,typename Arg2,typename Arg1>
struct function_traits_helper<R(*)(Arg12,Arg11,Arg10,Arg9,Arg8,Arg7,Arg6,Arg5,Arg4,Arg3,Arg2,Arg1)>
{
    typedef Arg11 arg11;
    typedef Arg10 arg10;
    typedef Arg9 arg9;
    typedef Arg8 arg8;
    typedef Arg7 arg7;
    typedef Arg6 arg6;
    typedef Arg5 arg5;
    typedef Arg4 arg4;
    typedef Arg3 arg3;
    typedef Arg2 arg2;
    typedef Arg1 arg1;

    enum{arity = 12};
    typedef R result_type;
};

template<typename R,
    typename Arg13,
    typename Arg12,
    typename Arg11,
    typename Arg10,
    typename Arg9,
    typename Arg8,typename Arg7,typename Arg6,typename Arg5,typename Arg4,typename Arg3,typename Arg2,typename Arg1>
struct function_traits_helper<R(*)(Arg13,Arg12,Arg11,Arg10,Arg9,Arg8,Arg7,Arg6,Arg5,Arg4,Arg3,Arg2,Arg1)>
{
    typedef Arg13 arg13;
    typedef Arg11 arg11;
    typedef Arg10 arg10;
    typedef Arg9 arg9;
    typedef Arg8 arg8;
    typedef Arg7 arg7;
    typedef Arg6 arg6;
    typedef Arg5 arg5;
    typedef Arg4 arg4;
    typedef Arg3 arg3;
    typedef Arg2 arg2;
    typedef Arg1 arg1;

    enum{arity = 13};
    typedef R result_type;
};

template<typename R,
    typename Arg14,
    typename Arg13,
    typename Arg12,
    typename Arg11,
    typename Arg10,
    typename Arg9,
    typename Arg8,typename Arg7,typename Arg6,typename Arg5,typename Arg4,typename Arg3,typename Arg2,typename Arg1>
struct function_traits_helper<R(*)(Arg14,Arg13,Arg12,Arg11,Arg10,Arg9,Arg8,Arg7,Arg6,Arg5,Arg4,Arg3,Arg2,Arg1)>
{
    typedef Arg14 arg14;
    typedef Arg13 arg13;
    typedef Arg11 arg11;
    typedef Arg10 arg10;
    typedef Arg9 arg9;
    typedef Arg8 arg8;
    typedef Arg7 arg7;
    typedef Arg6 arg6;
    typedef Arg5 arg5;
    typedef Arg4 arg4;
    typedef Arg3 arg3;
    typedef Arg2 arg2;
    typedef Arg1 arg1;

    enum{arity = 14};
    typedef R result_type;
};

template<typename R,
    typename Arg15,
    typename Arg14,
    typename Arg13,
    typename Arg12,
    typename Arg11,
    typename Arg10,
    typename Arg9,
    typename Arg8,typename Arg7,typename Arg6,typename Arg5,typename Arg4,typename Arg3,typename Arg2,typename Arg1>
struct function_traits_helper<R(*)(Arg15,Arg14,Arg13,Arg12,Arg11,Arg10,Arg9,Arg8,Arg7,Arg6,Arg5,Arg4,Arg3,Arg2,Arg1)>
{
    typedef Arg15 arg15;
    typedef Arg14 arg14;
    typedef Arg13 arg13;
    typedef Arg11 arg11;
    typedef Arg10 arg10;
    typedef Arg9 arg9;
    typedef Arg8 arg8;
    typedef Arg7 arg7;
    typedef Arg6 arg6;
    typedef Arg5 arg5;
    typedef Arg4 arg4;
    typedef Arg3 arg3;
    typedef Arg2 arg2;
    typedef Arg1 arg1;

    enum{arity = 15};
    typedef R result_type;
};

template<typename R,
    typename Arg16,
    typename Arg15,
    typename Arg14,
    typename Arg13,
    typename Arg12,
    typename Arg11,
    typename Arg10,
    typename Arg9,
    typename Arg8,typename Arg7,typename Arg6,typename Arg5,typename Arg4,typename Arg3,typename Arg2,typename Arg1>
struct function_traits_helper<R(*)(Arg16,Arg15,Arg14,Arg13,Arg12,Arg11,Arg10,Arg9,Arg8,Arg7,Arg6,Arg5,Arg4,Arg3,Arg2,Arg1)>
{
    typedef Arg16 arg16;
    typedef Arg15 arg15;
    typedef Arg14 arg14;
    typedef Arg13 arg13;
    typedef Arg11 arg11;
    typedef Arg10 arg10;
    typedef Arg9 arg9;
    typedef Arg8 arg8;
    typedef Arg7 arg7;
    typedef Arg6 arg6;
    typedef Arg5 arg5;
    typedef Arg4 arg4;
    typedef Arg3 arg3;
    typedef Arg2 arg2;
    typedef Arg1 arg1;

    enum{arity = 16};
    typedef R result_type;
};

template<typename R,
    typename Arg17,
    typename Arg16,
    typename Arg15,
    typename Arg14,
    typename Arg13,
    typename Arg12,
    typename Arg11,
    typename Arg10,
    typename Arg9,
    typename Arg8,typename Arg7,typename Arg6,typename Arg5,typename Arg4,typename Arg3,typename Arg2,typename Arg1>
struct function_traits_helper<R(*)(Arg17,Arg16,Arg15,Arg14,Arg13,Arg12,Arg11,Arg10,Arg9,Arg8,Arg7,Arg6,Arg5,Arg4,Arg3,Arg2,Arg1)>
{
    typedef Arg17 arg17;
    typedef Arg16 arg16;
    typedef Arg15 arg15;
    typedef Arg14 arg14;
    typedef Arg13 arg13;
    typedef Arg11 arg11;
    typedef Arg10 arg10;
    typedef Arg9 arg9;
    typedef Arg8 arg8;
    typedef Arg7 arg7;
    typedef Arg6 arg6;
    typedef Arg5 arg5;
    typedef Arg4 arg4;
    typedef Arg3 arg3;
    typedef Arg2 arg2;
    typedef Arg1 arg1;

    enum{arity = 17};
    typedef R result_type;
};

template<typename R,
    typename Arg18,
    typename Arg17,
    typename Arg16,
    typename Arg15,
    typename Arg14,
    typename Arg13,
    typename Arg12,
    typename Arg11,
    typename Arg10,
    typename Arg9,
    typename Arg8,typename Arg7,typename Arg6,typename Arg5,typename Arg4,typename Arg3,typename Arg2,typename Arg1>
struct function_traits_helper<R(*)(Arg18,Arg17,Arg16,Arg15,Arg14,Arg13,Arg12,Arg11,Arg10,Arg9,Arg8,Arg7,Arg6,Arg5,Arg4,Arg3,Arg2,Arg1)>
{
    typedef Arg18 arg18;
    typedef Arg17 arg17;
    typedef Arg16 arg16;
    typedef Arg15 arg15;
    typedef Arg14 arg14;
    typedef Arg13 arg13;
    typedef Arg11 arg11;
    typedef Arg10 arg10;
    typedef Arg9 arg9;
    typedef Arg8 arg8;
    typedef Arg7 arg7;
    typedef Arg6 arg6;
    typedef Arg5 arg5;
    typedef Arg4 arg4;
    typedef Arg3 arg3;
    typedef Arg2 arg2;
    typedef Arg1 arg1;

    enum{arity = 18};
    typedef R result_type;
};

template<typename R,
    typename Arg19,
    typename Arg18,
    typename Arg17,
    typename Arg16,
    typename Arg15,
    typename Arg14,
    typename Arg13,
    typename Arg12,
    typename Arg11,
    typename Arg10,
    typename Arg9,
    typename Arg8,typename Arg7,typename Arg6,typename Arg5,typename Arg4,typename Arg3,typename Arg2,typename Arg1>
struct function_traits_helper<R(*)(Arg19,Arg18,Arg17,Arg16,Arg15,Arg14,Arg13,Arg12,Arg11,Arg10,Arg9,Arg8,Arg7,Arg6,Arg5,Arg4,Arg3,Arg2,Arg1)>
{
    typedef Arg19 arg19;
    typedef Arg18 arg18;
    typedef Arg17 arg17;
    typedef Arg16 arg16;
    typedef Arg15 arg15;
    typedef Arg14 arg14;
    typedef Arg13 arg13;
    typedef Arg11 arg11;
    typedef Arg10 arg10;
    typedef Arg9 arg9;
    typedef Arg8 arg8;
    typedef Arg7 arg7;
    typedef Arg6 arg6;
    typedef Arg5 arg5;
    typedef Arg4 arg4;
    typedef Arg3 arg3;
    typedef Arg2 arg2;
    typedef Arg1 arg1;

    enum{arity = 19};
    typedef R result_type;
};

template<typename R,
    typename Arg20,
    typename Arg19,
    typename Arg18,
    typename Arg17,
    typename Arg16,
    typename Arg15,
    typename Arg14,
    typename Arg13,
    typename Arg12,
    typename Arg11,
    typename Arg10,
    typename Arg9,
    typename Arg8,typename Arg7,typename Arg6,typename Arg5,typename Arg4,typename Arg3,typename Arg2,typename Arg1>
struct function_traits_helper<R(*)(Arg20,Arg19,Arg18,Arg17,Arg16,Arg15,Arg14,Arg13,Arg12,Arg11,Arg10,Arg9,Arg8,Arg7,Arg6,Arg5,Arg4,Arg3,Arg2,Arg1)>
{
    typedef Arg20 arg20;
    typedef Arg19 arg19;
    typedef Arg18 arg18;
    typedef Arg17 arg17;
    typedef Arg16 arg16;
    typedef Arg15 arg15;
    typedef Arg14 arg14;
    typedef Arg13 arg13;
    typedef Arg11 arg11;
    typedef Arg10 arg10;
    typedef Arg9 arg9;
    typedef Arg8 arg8;
    typedef Arg7 arg7;
    typedef Arg6 arg6;
    typedef Arg5 arg5;
    typedef Arg4 arg4;
    typedef Arg3 arg3;
    typedef Arg2 arg2;
    typedef Arg1 arg1;

    enum{arity = 20};
    typedef R result_type;
};

template<typename _Function_Type>
struct function_traits : public function_traits_helper<typename function_pointer_traits<_Function_Type>::FunctionP_Type>
{
    typedef typename function_pointer_traits<_Function_Type>::Function_Type Function_Type;
    typedef typename function_pointer_traits<_Function_Type>::FunctionP_Type FunctionP_Type;
};

NAMESPACE_TRAITS_END
#endif
// fun_to_mem_converter.hpp

#ifndef FUN_TO_MEM_CONVERTER_INCLUDE
#define FUN_TO_MEM_CONVERTER_INCLUDE

#include "traits_config.hpp"
#include "function_traits.hpp"

NAMESPACE_TRAITS_BEGIN

template<int Arity,typename classtype, typename funtype>
struct fun_to_mem_converter_helper;

template<typename classtype,typename funtype>
struct fun_to_mem_converter_helper<0,classtype,funtype>
{
    typedef function_traits<funtype> _traits;

    typedef typename _traits::result_type(classtype::*MFunctionP_Type)();
};

template<typename classtype,typename funtype>
struct fun_to_mem_converter_helper<1,classtype,funtype>
{
    typedef function_traits<funtype> _traits;

    typedef typename _traits::result_type(classtype::*MFunctionP_Type)(typename _traits::arg1);
};

template<typename classtype,typename funtype>
struct fun_to_mem_converter_helper<2,classtype,funtype>
{
    typedef function_traits<funtype> _traits;

    typedef typename _traits::result_type(classtype::*MFunctionP_Type)(typename _traits::arg2,typename _traits::arg1);
};

template<typename classtype,typename funtype>
struct fun_to_mem_converter_helper<3,classtype,funtype>
{
    typedef function_traits<funtype> _traits;

    typedef typename _traits::result_type(classtype::*MFunctionP_Type)(typename _traits::arg3,typename _traits::arg2,typename _traits::arg1);
};

template<typename classtype,typename funtype>
struct fun_to_mem_converter_helper<4,classtype,funtype>
{
    typedef function_traits<funtype> _traits;

    typedef
        typename _traits::result_type(classtype::*MFunctionP_Type)
        (
        typename _traits::arg4,
        typename _traits::arg3,
        typename _traits::arg2,
        typename _traits::arg1);
};

template<typename classtype,typename funtype>
struct fun_to_mem_converter_helper<5,classtype,funtype>
{
    typedef function_traits<funtype> _traits;

    typedef
        typename _traits::result_type(classtype::*MFunctionP_Type)
        (
        typename _traits::arg5,
        typename _traits::arg4,
        typename _traits::arg3,
        typename _traits::arg2,
        typename _traits::arg1);
};

template<typename classtype,typename funtype>
struct fun_to_mem_converter_helper<6,classtype,funtype>
{
    typedef function_traits<funtype> _traits;

    typedef
        typename _traits::result_type(classtype::*MFunctionP_Type)
        (
        typename _traits::arg6,
        typename _traits::arg5,
        typename _traits::arg4,
        typename _traits::arg3,
        typename _traits::arg2,
        typename _traits::arg1);
};

template<typename classtype,typename funtype>
struct fun_to_mem_converter_helper<7,classtype,funtype>
{
    typedef function_traits<funtype> _traits;

    typedef
        typename _traits::result_type(classtype::*MFunctionP_Type)
        (
        typename _traits::arg7,
        typename _traits::arg6,
        typename _traits::arg5,
        typename _traits::arg4,
        typename _traits::arg3,
        typename _traits::arg2,
        typename _traits::arg1);
};

template<typename classtype,typename funtype>
struct fun_to_mem_converter_helper<8,classtype,funtype>
{
    typedef function_traits<funtype> _traits;

    typedef
        typename _traits::result_type(classtype::*MFunctionP_Type)
        (
        typename _traits::arg8,
        typename _traits::arg7,
        typename _traits::arg6,
        typename _traits::arg5,
        typename _traits::arg4,
        typename _traits::arg3,
        typename _traits::arg2,
        typename _traits::arg1);
};

template<typename classtype,typename funtype>
struct fun_to_mem_converter_helper<9,classtype,funtype>
{
    typedef function_traits<funtype> _traits;

    typedef
        typename _traits::result_type(classtype::*MFunctionP_Type)
        (
        typename _traits::arg9,
        typename _traits::arg8,
        typename _traits::arg7,
        typename _traits::arg6,
        typename _traits::arg5,
        typename _traits::arg4,
        typename _traits::arg3,
        typename _traits::arg2,
        typename _traits::arg1);
};

template<typename classtype,typename funtype>
struct fun_to_mem_converter_helper<10,classtype,funtype>
{
    typedef function_traits<funtype> _traits;

    typedef
        typename _traits::result_type(classtype::*MFunctionP_Type)
        (
        typename _traits::arg10,
        typename _traits::arg9,
        typename _traits::arg8,
        typename _traits::arg7,
        typename _traits::arg6,
        typename _traits::arg5,
        typename _traits::arg4,
        typename _traits::arg3,
        typename _traits::arg2,
        typename _traits::arg1);
};

template<typename classtype,typename funtype>
struct fun_to_mem_converter_helper<11,classtype,funtype>
{
    typedef function_traits<funtype> _traits;

    typedef
        typename _traits::result_type(classtype::*MFunctionP_Type)
        (
        typename _traits::arg11,
        typename _traits::arg10,
        typename _traits::arg9,
        typename _traits::arg8,
        typename _traits::arg7,
        typename _traits::arg6,
        typename _traits::arg5,
        typename _traits::arg4,
        typename _traits::arg3,
        typename _traits::arg2,
        typename _traits::arg1);
};

template<typename classtype,typename funtype>
struct fun_to_mem_converter_helper<12,classtype,funtype>
{
    typedef function_traits<funtype> _traits;

    typedef
        typename _traits::result_type(classtype::*MFunctionP_Type)
        (
        typename _traits::arg12,
        typename _traits::arg11,
        typename _traits::arg10,
        typename _traits::arg9,
        typename _traits::arg8,
        typename _traits::arg7,
        typename _traits::arg6,
        typename _traits::arg5,
        typename _traits::arg4,
        typename _traits::arg3,
        typename _traits::arg2,
        typename _traits::arg1);
};

template<typename classtype,typename funtype>
struct fun_to_mem_converter_helper<13,classtype,funtype>
{
    typedef function_traits<funtype> _traits;

    typedef
        typename _traits::result_type(classtype::*MFunctionP_Type)
        (
        typename _traits::arg13,
        typename _traits::arg12,
        typename _traits::arg11,
        typename _traits::arg10,
        typename _traits::arg9,
        typename _traits::arg8,
        typename _traits::arg7,
        typename _traits::arg6,
        typename _traits::arg5,
        typename _traits::arg4,
        typename _traits::arg3,
        typename _traits::arg2,
        typename _traits::arg1);
};

template<typename classtype,typename funtype>
struct fun_to_mem_converter_helper<14,classtype,funtype>
{
    typedef function_traits<funtype> _traits;

    typedef
        typename _traits::result_type(classtype::*MFunctionP_Type)
        (
        typename _traits::arg14,
        typename _traits::arg13,
        typename _traits::arg12,
        typename _traits::arg11,
        typename _traits::arg10,
        typename _traits::arg9,
        typename _traits::arg8,
        typename _traits::arg7,
        typename _traits::arg6,
        typename _traits::arg5,
        typename _traits::arg4,
        typename _traits::arg3,
        typename _traits::arg2,
        typename _traits::arg1);
};

template<typename classtype,typename funtype>
struct fun_to_mem_converter_helper<15,classtype,funtype>
{
    typedef function_traits<funtype> _traits;

    typedef
        typename _traits::result_type(classtype::*MFunctionP_Type)
        (
        typename _traits::arg15,
        typename _traits::arg14,
        typename _traits::arg13,
        typename _traits::arg12,
        typename _traits::arg11,
        typename _traits::arg10,
        typename _traits::arg9,
        typename _traits::arg8,
        typename _traits::arg7,
        typename _traits::arg6,
        typename _traits::arg5,
        typename _traits::arg4,
        typename _traits::arg3,
        typename _traits::arg2,
        typename _traits::arg1);
};

template<typename classtype,typename funtype>
struct fun_to_mem_converter_helper<16,classtype,funtype>
{
    typedef function_traits<funtype> _traits;

    typedef
        typename _traits::result_type(classtype::*MFunctionP_Type)
        (
        typename _traits::arg16,
        typename _traits::arg15,
        typename _traits::arg14,
        typename _traits::arg13,
        typename _traits::arg12,
        typename _traits::arg11,
        typename _traits::arg10,
        typename _traits::arg9,
        typename _traits::arg8,
        typename _traits::arg7,
        typename _traits::arg6,
        typename _traits::arg5,
        typename _traits::arg4,
        typename _traits::arg3,
        typename _traits::arg2,
        typename _traits::arg1);
};

template<typename classtype,typename funtype>
struct fun_to_mem_converter_helper<17,classtype,funtype>
{
    typedef function_traits<funtype> _traits;

    typedef
        typename _traits::result_type(classtype::*MFunctionP_Type)
        (
        typename _traits::arg17,
        typename _traits::arg16,
        typename _traits::arg15,
        typename _traits::arg14,
        typename _traits::arg13,
        typename _traits::arg12,
        typename _traits::arg11,
        typename _traits::arg10,
        typename _traits::arg9,
        typename _traits::arg8,
        typename _traits::arg7,
        typename _traits::arg6,
        typename _traits::arg5,
        typename _traits::arg4,
        typename _traits::arg3,
        typename _traits::arg2,
        typename _traits::arg1);
};

template<typename classtype,typename funtype>
struct fun_to_mem_converter_helper<18,classtype,funtype>
{
    typedef function_traits<funtype> _traits;

    typedef
        typename _traits::result_type(classtype::*MFunctionP_Type)
        (
        typename _traits::arg18,
        typename _traits::arg17,
        typename _traits::arg16,
        typename _traits::arg15,
        typename _traits::arg14,
        typename _traits::arg13,
        typename _traits::arg12,
        typename _traits::arg11,
        typename _traits::arg10,
        typename _traits::arg9,
        typename _traits::arg8,
        typename _traits::arg7,
        typename _traits::arg6,
        typename _traits::arg5,
        typename _traits::arg4,
        typename _traits::arg3,
        typename _traits::arg2,
        typename _traits::arg1);
};

template<typename classtype,typename funtype>
struct fun_to_mem_converter_helper<19,classtype,funtype>
{
    typedef function_traits<funtype> _traits;

    typedef
        typename _traits::result_type(classtype::*MFunctionP_Type)
        (
        typename _traits::arg19,
        typename _traits::arg18,
        typename _traits::arg17,
        typename _traits::arg16,
        typename _traits::arg15,
        typename _traits::arg14,
        typename _traits::arg13,
        typename _traits::arg12,
        typename _traits::arg11,
        typename _traits::arg10,
        typename _traits::arg9,
        typename _traits::arg8,
        typename _traits::arg7,
        typename _traits::arg6,
        typename _traits::arg5,
        typename _traits::arg4,
        typename _traits::arg3,
        typename _traits::arg2,
        typename _traits::arg1);
};

template<typename classtype,typename funtype>
struct fun_to_mem_converter_helper<20,classtype,funtype>
{
    typedef function_traits<funtype> _traits;

    typedef
        typename _traits::result_type(classtype::*MFunctionP_Type)
        (
        typename _traits::arg20,
        typename _traits::arg19,
        typename _traits::arg18,
        typename _traits::arg17,
        typename _traits::arg16,
        typename _traits::arg15,
        typename _traits::arg14,
        typename _traits::arg13,
        typename _traits::arg12,
        typename _traits::arg11,
        typename _traits::arg10,
        typename _traits::arg9,
        typename _traits::arg8,
        typename _traits::arg7,
        typename _traits::arg6,
        typename _traits::arg5,
        typename _traits::arg4,
        typename _traits::arg3,
        typename _traits::arg2,
        typename _traits::arg1);
};

template<typename Signature, typename classtype>
struct fun_to_mem_converter
{
    typedef
        typename fun_to_mem_converter_helper<function_traits<Signature>::arity,classtype,typename function_traits<Signature>::FunctionP_Type>::MFunctionP_Type
    MFunctionP_Type;
};

NAMESPACE_TRAITS_END
#endif
时间: 2025-01-09 02:25:43

头一回发博客,来分享个有关C++类型萃取的编写技巧的相关文章

知识管理:网摘如何快速存储不丢图不丢GIF、云同步、发博客。

摘要:我们在做文章收集或个人知识管理的时候,为了防止网络文章摘录内容丢失经常要归档.发布.编辑.共享一些从网上收集来的文摘,文摘有图文可能还有GIF动画,如用word,pdf 等板式会受到影响,且gif动画文件也会变成静态失去意义,本文主要是分享如何快速的复制粘贴发布.归档.发博文网络文章摘录. 一般来说,收集或个人知识管理(PKM)就是为了更高效的存储.检索.编辑.分享.组织吸纳创新所以本文,主要描述如何快速的存档网摘.发博客分享两个教程. 一.自用归档 可以选用 QQ空间日志:复制摘录的内容

我要发博客

ftp://bdtool.net/download/%E6%9C%80%E6%96%B0%E9%AB%98%E6%B8%85%E7%94%B5%E5%BD%B1/%5B7%E6%9C%8817%E6%97%A5%E5%8F%91%E5%B8%83%E6%9C%80%E6%96%B0%E9%AB%98%E6%B8%85%E7%89%88720P%5D%E5%8F%98%E5%BD%A2%E9%87%91%E5%88%9A4%EF%BC%9A%E7%BB%9D%E8%BF%B9%E9%87%8D%E

开通博客,分享技术心得!

开通博客,分享技术心得! 2013-05-13 开通博客,分享技术心得!,布布扣,bubuko.com

本地发博客的技巧

* 开通一个博客,比如我的是 http://www.cnblogs.com/toby2chen/ 是博客园的  记住要知名度高的博客 * windows live writer 安装  下载网址 http://windows.microsoft.com/zh-cn/windows/essentials  下载下来,安装,就是点下一步下一步的,这是综合包,我是只选择了windows live writer  其它的我没有选择,现在我只要这个,其它你也安装,试着用  * Notepad++ 安装,这

Linux江湖11:发博客必备的五大图片处理神器

发博客时,总免不了要用图片说话.经过长时间的磨合,在Linux桌面系统下有几款图片处理软件我已经用得比较顺手了.这几款软件在Linux世界使用广泛,各个Linux发行版的软件仓库中都有自带的安装包,而且这几款软件运行稳定.界面美观.特在这里推荐给大家. 请看我的桌面,左边的Luancher中下面的五个图标就是我今天要介绍的五款图片处理工具: 一.截图工具gnome-screenshot 这个软件不用自己安装,它是Gnome桌面自带的截图软件,一般在Linux系统安装完成后就自动安装了,它的软件名

正在使用word2013测试发博客

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; ? namespace demo1 { class Program { static void Main(string[] args) { int myInteger; string myString; myInteger = 17; myString = "\&qu

hexo next主题为博客添加分享功能

title: hexo next主题为博客添加分享功能 date: 2018-01-06 20:20:02 tags: [hexo博客, 博客配置] categories: hexo next主题配置 --- 今天心血来潮,决定给博客添加分享功能,百度上首先是找到了使用shareSDK的分享功能,最后在实践的过程中发现它添加时步骤比较多,添加完成后效果比较丑(就是一个长条的浅蓝色按钮),而且点击后想要退出分享比较麻烦(它的取消按钮实在太难找了,它在页面最下方的位置,呈现浅灰色,这个设计太反人类了

Linux 桌面玩家指南:05. 发博客必备的图片处理和视频录制神器

特别说明:要在我的随笔后写评论的小伙伴们请注意了,我的博客开启了 MathJax 数学公式支持,MathJax 使用$标记数学公式的开始和结束.如果某条评论中出现了两个$,MathJax 会将两个$之间的内容按照数学公式进行排版,从而导致评论区格式混乱.如果大家的评论中用到了$,但是又不是为了使用数学公式,就请使用\$转义一下,谢谢. 想从头阅读该系列吗?下面是传送门: Linux 桌面玩家指南:01. 玩转 Linux 系统的方法论 [约 1.1 万字,22 张图片] Linux 桌面玩家指南

关于如何使用Microsoft Word发博客

目前大部分的博客作者在用Word写博客这件事情上都会遇到以下3个痛点: 1.所有博客平台关闭了文档发布接口,用户无法使用Word,Windows Live Writer等工具来发布博客.使用Word写博客需要在第三方博客平台注册帐号,且需要第三方博客平台提供API接口.目前的有的博客平台均已关闭博客接口,所以无法使用Word来发布博客. 2.发布到博客或公众号平台的图片无法转载.由于所有博客平台,公众号平台(如微信)开启了图片防盗链功能,作者发布到这些平台上的图片则无法转载到其它的网站中,这限制