Since I'm one of those dodgy programmers who uses C + classes, I loiter here in an attempt to be fully converted to C++, you’ll be glad to hear it’s working, all be it a little slowly 8-)
Working with stringstreams I've found to be nice in the way of adding all sorts of types to a string ready to print or output to a file, however when say, assembling separate lines of text to be displayed, it would be nice to clear the stream last displayed and start adding to a new line of text (reusing the stream from empty) but there appears to be no member function to do this? Am I misusing stringstreams (ie there's something better for what I'm doing) or is it really the case of using the rather hackish method?
Usually simple string concatenation and to_string/lexical_cast-like functions are far more convenient than stringstreams, especially for simple cases, e.g.: setText("Status: "+to_string(status));
And no, there's no easier way to reset a stringstream.
Thanks Athar, really wanted to check I wasn't breaking anything with the str("") bit. So it's ok to do, just seems a bit odd.
I guess with the to_string function you mean write a function to take a value and return a string as the only to_string function I can find is for bit_set? Anyway, it's probably a good excercise for writing a template function taking different types?
std::to_string is in C++11. If your implementation doesn't have it yet you can do as you said. Writing the function with templates using stringstream inside is not very hard.