aboutsummaryrefslogtreecommitdiff
path: root/contrib/epee/include/byte_stream.h
diff options
context:
space:
mode:
authorLee Clagett <code@leeclagett.com>2020-08-17 16:20:09 -0400
committerLee Clagett <code@leeclagett.com>2020-08-17 21:30:34 -0400
commitb641e0a2c0f70227a526cfafd4977c87f724a6da (patch)
treea56688591a79b99ab717d9ef06c48b97678d6374 /contrib/epee/include/byte_stream.h
parentRevert "Use domain-separated ChaCha20 for in-memory key encryption" (diff)
downloadmonero-b641e0a2c0f70227a526cfafd4977c87f724a6da.tar.xz
Add clear method to byte_stream
Diffstat (limited to 'contrib/epee/include/byte_stream.h')
-rw-r--r--contrib/epee/include/byte_stream.h3
1 files changed, 3 insertions, 0 deletions
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. */