I this a good way to convert int to string?
int a = 123456789;
string str = static_cast<ostringstream*>(&(ostringstream()<<a))->str();
I this a good way to convert int to string?
int a = 123456789;
string str = static_cast<ostringstream*>(&(ostringstream()<<a))->str();
C++11 introduced std::to_string
for this very purpose:
int a = 123456789;
std::string str = std::to_string(a);