I\'ve had quite a bit of trouble trying to write a function that checks if a string is a number. For a game I am writing I just need to check if a line from the file I am r
With C++11 compiler, for non-negative integers I would use something like this (note the :: instead of std::):
::
std::
bool is_number(const std::string &s) { return !s.empty() && std::all_of(s.begin(), s.end(), ::isdigit); }
http://ideone.com/OjVJWh