views:

150

answers:

3

Hi,

In a template function, I like to determine the range for the value of its template type. For specific type, like int, INT_MAX and INT_MIN are what I want. But how to do the same for a template type?

Thanks and regards!

A: 

This is done with type traits like those from boost

fa.
+1  A: 

For numeric types, you can use the std::numeric_limits class template in the <limits> header.

Jeff Hardy
A: 

See the <limits> header and std::numeric_limits

sellibitze