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;
}
posted on 2018-08-01 20:24  闻缺陷则喜何志丹  阅读(2)  评论(0)    收藏  举报  来源