Boost logo

Boost Users :

From: Jeff Flinn (TriumphSprint2000_at_[hidden])
Date: 2008-02-01 13:02:58


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


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net