if you cannot use boost or C++0x then you'll probably need to define a custom trait specialized for each signed/unsigned type
of course, things get complicated if you want automatic type deduction ...Code:template <typename T> struct signed_t {}; template <typename T> struct unsigned_t {}; template <> struct signed_t<int> { typedef signed int type; }; template <> struct unsigned_t<int> { typedef unsigned int type; }; // ... template<class T> void f( typename unsigned_t<T>::type v1, typename signed_t<T>::type v2 ); int main() { f<int>(1,1); }




Reply With Quote