forked from boostorg/beast
read_size replaces read_size_helper:
* detail::read_size_helper is removed * public function read_size helps determine the optimum size for calls to a DynamicBuffer's prepare function. * special case for Asio types which don't conform to the concept but have their own helper function.
This commit is contained in:
@@ -9,8 +9,8 @@
|
||||
#define BEAST_TEST_BUFFER_TEST_HPP
|
||||
|
||||
#include <beast/core/string_view.hpp>
|
||||
#include <beast/core/read_size.hpp>
|
||||
#include <beast/core/type_traits.hpp>
|
||||
#include <beast/core/detail/read_size_helper.hpp>
|
||||
#include <beast/core/detail/type_traits.hpp>
|
||||
#include <boost/asio/buffer.hpp>
|
||||
#include <algorithm>
|
||||
@@ -112,37 +112,6 @@ size_rev_post(ConstBufferSequence const& buffers)
|
||||
return n;
|
||||
}
|
||||
|
||||
namespace has_read_size_helper
|
||||
{
|
||||
using beast::detail::read_size_helper;
|
||||
|
||||
template<class T, class = void>
|
||||
struct trait : std::false_type {};
|
||||
|
||||
template<class T>
|
||||
struct trait<T, decltype(
|
||||
std::declval<std::size_t&>() =
|
||||
read_size_helper(std::declval<T>(), 0),
|
||||
(void)0)> : std::true_type
|
||||
{
|
||||
};
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
// Make sure read_size_helper works
|
||||
template<class DynamicBuffer>
|
||||
inline
|
||||
void
|
||||
check_read_size_helper()
|
||||
{
|
||||
static_assert(is_dynamic_buffer<DynamicBuffer>::value,
|
||||
"DynamicBuffer requirements not met ");
|
||||
|
||||
static_assert(has_read_size_helper::trait<DynamicBuffer>::value,
|
||||
"Missing read_size_helper for dynamic buffer");
|
||||
}
|
||||
|
||||
} // test
|
||||
} // beast
|
||||
|
||||
|
||||
Reference in New Issue
Block a user