I have a string object and an istringstream object and I was wondering if it was possible to set the string data in the stringstream using a member function.
I know you can initialize an istringstream like this:
Code:
istringstream somestream(somestring);
But I wasn't able to find a straightforward way to recycle the stringstream with a member function. The only way I was able to think of was:
Code:
istringstream* somestream;
somestream = new istringstream(somestring);
//do something with the stream
delete somestream;
somestream = new istringstream(someotherstring);
//do something else with the stream
delete somestream;
It works, but I have a feeling there's a better way to do it. But how?