Refactor flat_static_buffer

This commit is contained in:
Richard Hodges
2020-02-26 10:50:52 +01:00
committed by Vinnie Falco
parent 25c8fb4714
commit ea078cfcdb
3 changed files with 21 additions and 10 deletions

View File

@@ -4,14 +4,24 @@ Version 286:
* Refactor buffers_adapter * Refactor buffers_adapter
* Refactor static_buffer * Refactor static_buffer
* Refactor flat_buffer * Refactor flat_buffer
* Refactor flat_static_buffer
API Changes: API Changes:
* multi_buffer::mutable_data_type is deprecated. Use multi_buffer::mutable_buffers_type instead. * Nested const and mutable buffer types for all
* buffers_adaptor::mutable_data_type is deprecated. Use buffers_adaptor::mutable_buffers_type instead. Beast dynamic buffers are refactored. Affected types:
* static_buffer::mutable_data_type is deprecated. Use static_buffer::mutable_buffers_type instead. - buffers_adapter
* static_buffer_base::mutable_data_type is deprecated. Use static_buffer_base::mutable_buffers_type instead. - flat_buffer
* flat_buffer::mutable_data_type is deprecated. Use flat_buffer::mutable_buffers_type instead. - flat_static_buffer
- multi_buffer
- static_buffer
* Nested mutable_data_type in Beast dynamic buffers is deprecated:
Changes Required:
* Use nested mutable_buffers_type instead of mutable_data_type,
or define BOOST_BEAST_ALLOW_DEPRECATED
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------

View File

@@ -114,8 +114,9 @@ public:
/// The ConstBufferSequence used to represent the readable bytes. /// The ConstBufferSequence used to represent the readable bytes.
using const_buffers_type = net::const_buffer; using const_buffers_type = net::const_buffer;
/// The MutableBufferSequence used to represent the readable bytes. #ifdef BOOST_BEAST_ALLOW_DEPRECATED
using mutable_data_type = net::mutable_buffer; using mutable_data_type = net::mutable_buffer;
#endif
/// The MutableBufferSequence used to represent the writable bytes. /// The MutableBufferSequence used to represent the writable bytes.
using mutable_buffers_type = net::mutable_buffer; using mutable_buffers_type = net::mutable_buffer;
@@ -156,7 +157,7 @@ public:
} }
/// Returns a mutable buffer sequence representing the readable bytes /// Returns a mutable buffer sequence representing the readable bytes
mutable_data_type mutable_buffers_type
data() noexcept data() noexcept
{ {
return {in_, dist(in_, out_)}; return {in_, dist(in_, out_)};

View File

@@ -244,7 +244,7 @@ struct is_mutable_dynamic_buffer<T, detail::void_t<decltype(
std::declval<T const&>().data(), std::declval<T const&>().data(),
std::declval<typename T::const_buffers_type&>() = std::declval<typename T::const_buffers_type&>() =
std::declval<T&>().cdata(), std::declval<T&>().cdata(),
std::declval<typename T::mutable_data_type&>() = std::declval<typename T::mutable_buffers_type&>() =
std::declval<T&>().data() std::declval<T&>().data()
) > > : net::is_dynamic_buffer_v1<T> ) > > : net::is_dynamic_buffer_v1<T>
{ {
@@ -287,11 +287,11 @@ test_mutable_dynamic_buffer(
{ {
BOOST_STATIC_ASSERT( BOOST_STATIC_ASSERT(
net::is_mutable_buffer_sequence<typename net::is_mutable_buffer_sequence<typename
MutableDynamicBuffer_v0::mutable_data_type>::value); MutableDynamicBuffer_v0::mutable_buffers_type>::value);
BOOST_STATIC_ASSERT( BOOST_STATIC_ASSERT(
std::is_convertible< std::is_convertible<
typename MutableDynamicBuffer_v0::mutable_data_type, typename MutableDynamicBuffer_v0::mutable_buffers_type,
typename MutableDynamicBuffer_v0::const_buffers_type>::value); typename MutableDynamicBuffer_v0::const_buffers_type>::value);
string_view src = "Hello, world!"; string_view src = "Hello, world!";