现在的位置: 首页 > 综合 > 正文

UnSignType

2018年07月11日 ⁄ 综合 ⁄ 共 281字 ⁄ 字号 评论关闭

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)

//测试程序

void main()
{
    UnSignType<int>::TYPE c;
}

抱歉!评论已关闭.