Commit 4f023e31 authored by mercury233's avatar mercury233

use insert in BufferIO::VectorWriteBlock

parent bbd99ad4
...@@ -22,9 +22,8 @@ public: ...@@ -22,9 +22,8 @@ public:
} }
static void VectorWriteBlock(std::vector<unsigned char>& buffer, const void* src, size_t size) { static void VectorWriteBlock(std::vector<unsigned char>& buffer, const void* src, size_t size) {
const auto len = buffer.size(); auto* bytes = static_cast<const unsigned char*>(src);
buffer.resize(len + size); buffer.insert(buffer.end(), bytes, bytes + size);
std::memcpy(buffer.data() + len, src, size);
} }
template<typename T> template<typename T>
static void VectorWrite(std::vector<unsigned char>& buffer, const T& value) { static void VectorWrite(std::vector<unsigned char>& buffer, const T& value) {
......
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