Commit b2f9a1c9 authored by Dominik Charousset's avatar Dominik Charousset

Switch to std::copy

parent 05eae2f0
...@@ -255,8 +255,7 @@ protected: ...@@ -255,8 +255,7 @@ protected:
std::streamsize xsputn(const char_type* s, std::streamsize n) override { std::streamsize xsputn(const char_type* s, std::streamsize n) override {
auto available = this->epptr() - this->pptr(); auto available = this->epptr() - this->pptr();
auto actual = std::min(n, static_cast<std::streamsize>(available)); auto actual = std::min(n, static_cast<std::streamsize>(available));
std::memcpy(this->pptr(), s, std::copy(s, s + actual, this->pptr());
static_cast<size_t>(actual) * sizeof(char_type));
this->safe_pbump(actual); this->safe_pbump(actual);
return actual; return actual;
} }
...@@ -266,8 +265,7 @@ protected: ...@@ -266,8 +265,7 @@ protected:
std::streamsize xsgetn(char_type* s, std::streamsize n) override { std::streamsize xsgetn(char_type* s, std::streamsize n) override {
auto available = this->egptr() - this->gptr(); auto available = this->egptr() - this->gptr();
auto actual = std::min(n, static_cast<std::streamsize>(available)); auto actual = std::min(n, static_cast<std::streamsize>(available));
std::memcpy(s, this->gptr(), std::copy(this->gptr(), this->gptr() + actual, s);
static_cast<size_t>(actual) * sizeof(char_type));
this->safe_gbump(actual); this->safe_gbump(actual);
return actual; return actual;
} }
......
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