https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63466
Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |WORKSFORME --- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> --- The C code: $ time ./tstream-c < testfile real 0m0.058s user 0m0.055s sys 0m0.003s My rewrite without <sstream> from comment 4: $ time ./a.out < testfile real 0m0.095s user 0m0.089s sys 0m0.006s So I still don't think there's anything to "fix" here. If you don't need the full flexibility of a stringstream (and new variables to hold copies of the input, rather than splitting in in-place) then don't do it that way.