mirror of
https://github.com/boostorg/beast.git
synced 2025-08-04 15:24:31 +02:00
Add flat_static_buffer::mutable_data
This commit is contained in:
@@ -1,3 +1,9 @@
|
||||
Version 83:
|
||||
|
||||
* Add flat_static_buffer::mutable_data
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Version 82:
|
||||
|
||||
* Documentation tidying
|
||||
|
@@ -51,6 +51,12 @@ public:
|
||||
*/
|
||||
using const_buffers_type = boost::asio::const_buffers_1;
|
||||
|
||||
/** The type used to represent the mutable input sequence as a list of buffers.
|
||||
|
||||
This buffer sequence is guaranteed to have length 1.
|
||||
*/
|
||||
using mutable_data_type = boost::asio::mutable_buffers_1;
|
||||
|
||||
/** The type used to represent the output sequence as a list of buffers.
|
||||
|
||||
This buffer sequence is guaranteed to have length 1.
|
||||
@@ -98,6 +104,13 @@ public:
|
||||
const_buffers_type
|
||||
data() const;
|
||||
|
||||
/** Get a list of mutable buffers that represent the input sequence.
|
||||
|
||||
@note These buffers remain valid across subsequent calls to `prepare`.
|
||||
*/
|
||||
mutable_data_type
|
||||
mutable_data();
|
||||
|
||||
/** Get a list of buffers that represent the output sequence, with the given size.
|
||||
|
||||
@throws std::length_error if the size would exceed the limit
|
||||
|
@@ -32,6 +32,15 @@ data() const ->
|
||||
return {in_, dist(in_, out_)};
|
||||
}
|
||||
|
||||
inline
|
||||
auto
|
||||
flat_static_buffer_base::
|
||||
mutable_data() ->
|
||||
mutable_data_type
|
||||
{
|
||||
return {in_, dist(in_, out_)};
|
||||
}
|
||||
|
||||
inline
|
||||
auto
|
||||
flat_static_buffer_base::
|
||||
|
@@ -102,6 +102,7 @@ public:
|
||||
ba.commit(buffer_copy(d, buffer(s.data()+x+y, z)));
|
||||
}
|
||||
ba.commit(2);
|
||||
BEAST_EXPECT(buffer_size(ba.data()) == buffer_size(ba.mutable_data()));
|
||||
BEAST_EXPECT(ba.size() == x + y + z);
|
||||
BEAST_EXPECT(buffer_size(ba.data()) == ba.size());
|
||||
BEAST_EXPECT(to_string(ba.data()) == s);
|
||||
|
Reference in New Issue
Block a user