I need to iterate over the content of a StringStream twice. Because StringStream does not provide a seek method, I thought instead to create a new StringStream from the first stream's data attribute and assigning it to the same variable.strm = newStringStream(...)
Iterate through strm...
strm = newStringStream(strm.data)
Iterate again through strm...
This works in my tests and looks to me reasonably elegant, but is this safe for all stream sizes?