Since c++11 the <string>
header provides :
To convert from std::string
to signed integers.
We also have their unsigned counterpart :
Now, even a child would notice something is missing right ? :)
So the question is: is there a reason not to provide an std::stoui
or is it just something that was forgotten (And basically how could something this "obvious" be forgotten)?
Also, does that mean that the correct way of converting an std::string
to unsigned int
is :
unsigned int ui = static_cast<unsigned int>(std::stoul(std::string{"42"}));