std::to_string

Hi,

I cannot find reference to std::to_string (C++11). Is it available on the site? If so, where?

Thank you very much for the great C++ reference site, I use it daily.

Dom
From the C++ Standard

string to_string(int val);
string to_string(unsigned val);
string to_string(long val);
string to_string(unsigned long val);
string to_string(long long val);
string to_string(unsigned long long val);
string to_string(float val);
string to_string(double val);
string to_string(long double val);

7 Returns: Each function returns a string object holding the character representation of the value of its argument that would be generated by calling sprintf(buf, fmt, val) with a format specifier of "%d", "%u", "%ld", "%lu", "%lld", "%llu", "%f", "%f", or "%Lf", respectively, where buf designates an internal character buffer of sufficient size.


Take into account that MS VC++ 2010 does not support all listed parameter types. So you have to use casting to an appropriate type.
Last edited on
I don't think this site has anything about to_string yet. You can use cppreference.com instead.
http://en.cppreference.com/w/cpp/string/basic_string/to_string
Topic archived. No new replies allowed.