forked from boostorg/beast
Add flat_static_buffer::reset
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
Version 106:
|
||||
|
||||
* Dynamic buffer input areas are mutable
|
||||
* Add flat_static_buffer::reset
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
|
@@ -114,6 +114,10 @@ public:
|
||||
mutable_data_type
|
||||
mutable_data();
|
||||
|
||||
/// Set the input and output sequences to size 0
|
||||
void
|
||||
reset();
|
||||
|
||||
/** 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
|
||||
@@ -147,10 +151,10 @@ protected:
|
||||
/** Constructor
|
||||
|
||||
The buffer will be in an undefined state. It is necessary
|
||||
for the derived class to call @ref reset in order to
|
||||
initialize the object.
|
||||
for the derived class to call @ref reset with a pointer
|
||||
and size in order to initialize the object.
|
||||
*/
|
||||
flat_static_buffer_base();
|
||||
flat_static_buffer_base() = default;
|
||||
|
||||
/** Reset the pointed-to buffer.
|
||||
|
||||
@@ -175,6 +179,10 @@ private:
|
||||
return static_cast<std::size_t>(last - first);
|
||||
}
|
||||
|
||||
template<class = void>
|
||||
void
|
||||
reset_impl();
|
||||
|
||||
template<class = void>
|
||||
void
|
||||
reset_impl(void* p, std::size_t n);
|
||||
|
@@ -44,6 +44,14 @@ mutable_data() ->
|
||||
return {in_, dist(in_, out_)};
|
||||
}
|
||||
|
||||
inline
|
||||
void
|
||||
flat_static_buffer_base::
|
||||
reset()
|
||||
{
|
||||
reset_impl();
|
||||
}
|
||||
|
||||
inline
|
||||
auto
|
||||
flat_static_buffer_base::
|
||||
@@ -61,6 +69,16 @@ reset(void* p, std::size_t n)
|
||||
reset_impl(p, n);
|
||||
}
|
||||
|
||||
template<class>
|
||||
void
|
||||
flat_static_buffer_base::
|
||||
reset_impl()
|
||||
{
|
||||
in_ = begin_;
|
||||
out_ = begin_;
|
||||
last_ = begin_;
|
||||
}
|
||||
|
||||
template<class>
|
||||
void
|
||||
flat_static_buffer_base::
|
||||
|
Reference in New Issue
Block a user