template<class T>
class UnSignType
{
//如果缺少Type 请用UNSIGN_TYPE宏添加偏特化
};
#define UNSIGN_TYPE(t) \
template<> \
struct UnSignType<t> \
{\
typedef unsigned t TYPE;\
};
UNSIGN_TYPE(char)
UNSIGN_TYPE(short)
UNSIGN_TYPE(int)
UNSIGN_TYPE(long)
UNSIGN_TYPE(__int64)
{
UnSignType<int>::TYPE c;
}
class UnSignType
{
//如果缺少Type 请用UNSIGN_TYPE宏添加偏特化
};
#define UNSIGN_TYPE(t) \
template<> \
struct UnSignType<t> \
{\
typedef unsigned t TYPE;\
};
UNSIGN_TYPE(char)
UNSIGN_TYPE(short)
UNSIGN_TYPE(int)
UNSIGN_TYPE(long)
UNSIGN_TYPE(__int64)
//测试程序
{
UnSignType<int>::TYPE c;
}