diff options
Diffstat (limited to 'boost/beast/core/buffers_to_string.hpp')
-rw-r--r-- | boost/beast/core/buffers_to_string.hpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/boost/beast/core/buffers_to_string.hpp b/boost/beast/core/buffers_to_string.hpp index 1c70768ebc..86efa3d3cc 100644 --- a/boost/beast/core/buffers_to_string.hpp +++ b/boost/beast/core/buffers_to_string.hpp @@ -1,5 +1,5 @@ // -// Copyright (c) 2016-2017 Vinnie Falco (vinnie dot falco at gmail dot com) +// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) @@ -11,7 +11,8 @@ #define BOOST_BEAST_BUFFERS_TO_STRING_HPP #include <boost/beast/core/detail/config.hpp> -#include <boost/beast/core/detail/type_traits.hpp> +#include <boost/beast/core/buffer_traits.hpp> +#include <boost/beast/core/buffers_range.hpp> #include <boost/asio/buffer.hpp> #include <string> @@ -41,16 +42,17 @@ namespace beast { @endcode */ template<class ConstBufferSequence> -inline std::string buffers_to_string(ConstBufferSequence const& buffers) { + static_assert( + net::is_const_buffer_sequence<ConstBufferSequence>::value, + "ConstBufferSequence type requirements not met"); std::string result; - result.reserve(boost::asio::buffer_size(buffers)); - for(boost::asio::const_buffer buffer : - detail::buffers_range(buffers)) - result.append(static_cast< - char const*>(buffer.data()), buffer.size()); + result.reserve(buffer_bytes(buffers)); + for(auto const buffer : buffers_range_ref(buffers)) + result.append(static_cast<char const*>( + buffer.data()), buffer.size()); return result; } |