Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

4
  • So it does, my bad. Commented Nov 25, 2018 at 5:49
  • @NicHartley: No problem, but would you mind removing your downvote? :) Commented Nov 25, 2018 at 5:50
  • Votes are locked in after 15 minutes, so unfortunately I can't. The seekp thing solved my problem; I'd upvote this if I could. Commented Nov 25, 2018 at 5:55
  • 1
    @NicHartley: Ah. No worries. I believe the seekp approach copies more data around, even with C++11 move semantics. Come to think of it, the simplest and fastest approach is probably just to create a new stringstream and swap (or std::move) the guts. I went ahead and edited my answer, which also should allow you to change your vote. Commented Nov 25, 2018 at 6:16