here is a quite simple question(I think), is there a STL library method that provides the limit of a variable type (e.g integer) ?
Use std::numeric_limits:
// numeric_limits example
// from the page I linked
#include
#include
using namespace std;
int main () {
cout << boolalpha;
cout << "Minimum value for int: " << numeric_limits::min() << endl;
cout << "Maximum value for int: " << numeric_limits::max() << endl;
cout << "int is signed: " << numeric_limits::is_signed << endl;
cout << "Non-sign bits in int: " << numeric_limits::digits << endl;
cout << "int has infinity: " << numeric_limits::has_infinity << endl;
return 0;
}