From b641e0a2c0f70227a526cfafd4977c87f724a6da Mon Sep 17 00:00:00 2001 From: Lee Clagett Date: Mon, 17 Aug 2020 16:20:09 -0400 Subject: Add clear method to byte_stream --- contrib/epee/include/byte_stream.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'contrib/epee/include') diff --git a/contrib/epee/include/byte_stream.h b/contrib/epee/include/byte_stream.h index 98f563ca9..42a9e1dd9 100644 --- a/contrib/epee/include/byte_stream.h +++ b/contrib/epee/include/byte_stream.h @@ -117,6 +117,9 @@ namespace epee check(more); } + //! Reset write position, but do not release internal memory. \post `size() == 0`. + void clear() noexcept { next_write_ = buffer_.get(); } + /*! Copy `length` bytes starting at `ptr` to end of stream. \throw std::range_error If exceeding max size_t value. \throw std::bad_alloc If allocation fails. */ -- cgit v1.2.3