but if I try to use it again with another string, I don't get the correct behavior. I know the string is valid because if I declare a new stringstream it formats just fine
1 2 3 4
//second time through, values are not read in from lconvert
lconvert << lvalstr;
lconvert >> (*lptrans)[0][0];
lconvert >> (*lptrans)[0][1];
1 2 3 4 5
//second time through, this works if i use a new stringstream
std::stringstream lconvert2;
lconvert2 << lvalstr;
lconvert2 >> (*lptrans)[0][0];
lconvert2 >> (*lptrans)[0][1];
Is the solution to just use a stringstream* and just allocate/delete each time I need a stream?
Is the solution to just use a stringstream* and just allocate/delete each time I need a stream?
¿but why will you use dynamic allocation for that? lconvert = std::stringstream(lvalstr);
You could also set the value with str but you will need to call clear too. (error prone)
The problem is that after you finish reading those values the stream remains in an error state, and the later insertion fails.