diff options
Diffstat (limited to 'src/cpp/util')
-rw-r--r-- | src/cpp/util/byte_buffer.cc | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/cpp/util/byte_buffer.cc b/src/cpp/util/byte_buffer.cc index 467f0007de..91e202023c 100644 --- a/src/cpp/util/byte_buffer.cc +++ b/src/cpp/util/byte_buffer.cc @@ -89,4 +89,10 @@ ByteBuffer::ByteBuffer(const ByteBuffer& buf): buffer_(grpc_byte_buffer_copy(buf.buffer_)) { } +ByteBuffer& ByteBuffer::operator=(const ByteBuffer& buf) { + Clear(); // first remove existing data + buffer_ = grpc_byte_buffer_copy(buf.buffer_); // then copy + return *this; +} + } // namespace grpc |