What I want to do is this:
int num = 10;
string message = "something something " + num;
cout<<message<<endl;
the output would be: something something 10
The compiler I'm being forced to use is an outdated version of GCC, and does not have C++ 11 support, which means to_string will not work.
Is string stream the only way? If so, how would I use it in this case to produce the least amount of code?
cout<<message<<num<<endl;in this case? And yes, stringstream is probably the easiest general solution, others exist tho.boost::lexical_castwill do this almost just as easily.