src: Use std::copy instead of std::copy_n since gcc-4.7 does not have it

This commit is contained in:
Tatsuhiro Tsujikawa 2015-02-05 23:42:50 +09:00
parent ab6663c785
commit 9a2d36fc6c
2 changed files with 4 additions and 3 deletions

View File

@ -43,7 +43,8 @@ template <size_t N> struct Buffer {
// |src|. Returns number of bytes written.
size_t write(const void *src, size_t count) {
count = std::min(count, wleft());
last = std::copy_n(static_cast<const uint8_t *>(src), count, last);
auto p = static_cast<const uint8_t *>(src);
last = std::copy(p, p + count, last);
return count;
}
size_t write(size_t count) {

View File

@ -134,7 +134,7 @@ template <typename Memchunk> struct Memchunks {
for (;;) {
auto n = std::min(static_cast<size_t>(last - first), tail->left());
tail->last = std::copy_n(first, n, tail->last);
tail->last = std::copy(first, first + n, tail->last);
first += n;
len += n;
if (first == last) {
@ -165,7 +165,7 @@ template <typename Memchunk> struct Memchunks {
auto n = std::min(static_cast<size_t>(last - first), m->len());
assert(m->len());
first = std::copy_n(m->pos, n, first);
first = std::copy(m->pos, m->pos + n, first);
m->pos += n;
len -= n;
if (m->len() > 0) {