C++11 – Why std::stoi Exists but Not std::itos

cc++11parsingstrings

I noticed to my glee that C++11 has a std::sto@ family of functions for easily unpacking ints/floats/longs whatever from strings. I'm surprised however, that the opposite isn't implemented. Why didn't the standards committee include a std::itos family of functions for going from ints/floats/whatever (back) to strings?

Best Answer

I was mistaken, there is a set of "Xtos" functions, they are all just named to_string. Each to_string is overloaded to take a different basic type, i.e.:

std::string to_string(float f);
std::string to_string(int f);
...

See here for more info.