天天看點

UnSignType

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;

 }