I'm trying to convert a numeric std::string to an integer using std::istringstream
std::istringstream convertor;
convertor.str(mystring);
convertor >> myint;
I want to throw an exception if the numeric string is over (or under) the limits of an integer, but I don't know what is the best way to do so. I wonder if there is something specific to std::istringstream or something else made especially for this purpose, or do I have to use dirty (it seems dirty at least :) ) ways with numeric_limits
?
Thank you for your help.