
1 Feb
2008
1 Feb
'08
6:02 p.m.
Stephen Torri wrote:
Is there a way to detect a unsigned integer? I would like to have a template to replace a macro that checks a value is in a range. Here is what I have so far:
template <typename Limit_Type> static inline void in_range ( boost::uint32_t value, Limit_Type limit ) { if ( value > limit ) { throw errors::Internal_Exception ( errors::Internal_Exception::INVALID_VALUE ); } }
I would like to replace the "boost::uint32_t" with a default typename and check to see if the 'value' is an unsigned type.
See boost/type_traits/is_signed.hpp Jeff Flinn