Simple question just out of curiosity.
Multiple methods on a class need to use a stringstream, or specifically an ostringstream.
1) Have a stringstream variable as a class member and then just clear it before using it i.e. msg.str("")
2) Create a new stringstream variable locally in each method each time you need to use it.
Which is the best way of implementing this, in terms of efficiency and neatness?
My hunch is option 1, but not sure if the initial construction combined with each call to str() would be worse?
P.S. I've read Initializing.. which one is more efficient? and Which is quicker/more efficient?, my next step would be for me to look into profiling and writing a small test app, but I felt asking might be quicker :-)