C++11 added some new string conversion functions:
http://en.cppreference.com/w/cpp/string/basic_string/stoul
It includes stoi (string to int), stol (string to long), stoll (string to long long), stoul (string to unsigned long), stoull (string to unsigned long long). Notable in its absence is a stou (string to unsigned) function. Is there some reason it is not needed but all of the others are?
related: No "sto{short, unsigned short}" functions in C++11?
unsigned long
just is nounsigned int
. – Christian Rauunsigned long
is 64 bits, andunsigned int
32. They are different types, and can't be assumed to be the same as each other. – Mike Seymourstou
"-question, but a question asking for a possibly definite reason for this obvious inconsistency. If you know there is no such reason, then well, post it as an answer. – Christian Rau