From 8469eb6b4c70ef04e6ff09d2116ca6b7a630602f Mon Sep 17 00:00:00 2001 From: jack Date: Tue, 5 Apr 2016 22:27:32 +0800 Subject: [PATCH] Get the current total capacity of the streambuf. --- include/boost/asio/basic_streambuf.hpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/include/boost/asio/basic_streambuf.hpp b/include/boost/asio/basic_streambuf.hpp index d8cb477b..b863cedb 100644 --- a/include/boost/asio/basic_streambuf.hpp +++ b/include/boost/asio/basic_streambuf.hpp @@ -161,6 +161,16 @@ class basic_streambuf return pptr() - gptr(); } + /// Get the current capacity of the basic_streambuf. + /** + * @returns The current total capacity of the streambuf, i.e. for both the + * input sequence and output sequence. + */ + std::size_t capacity() const + { + return buffer_.capacity(); + } + /// Get the maximum size of the basic_streambuf. /** * @returns The allowed maximum of the sum of the sizes of the input sequence