Commit c1a9059d authored by Tobias Mayer's avatar Tobias Mayer

Use insert for faster appending in xsputn

parent 4466c76f
...@@ -365,11 +365,7 @@ protected: ...@@ -365,11 +365,7 @@ protected:
} }
std::streamsize xsputn(const char_type* s, std::streamsize n) override { std::streamsize xsputn(const char_type* s, std::streamsize n) override {
// TODO: Do a performance analysis whether the current implementation based container_.insert(container_.end(), s, s + n);
// on copy_n is faster than these two statements:
// (1) container_.resize(container_.size() + n);
// (2) std::memcpy(this->pptr(), s, n * sizeof(char_type));
std::copy_n(s, n, std::back_inserter(container_));
return n; return n;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment