Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I noticed to my glee that C++11 has a std stoX 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 to strings?

share|improve this question
add comment

1 Answer

up vote 16 down vote accepted

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

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

See here for more info.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.