![]() |
Home | Libraries | People | FAQ | More |
Return a non-owning reference to a dynamic buffer.
Defined in header <boost/beast/core/dynamic_buffer_ref.hpp>
template< class DynamicBuffer> dynamic_buffer_ref_wrapper< DynamicBuffer > dynamic_buffer_ref( DynamicBuffer& buffer);
This function returns a wrapper which holds a reference to the passed dynamic buffer. The wrapper meets the requirements of DynamicBuffer, allowing its use in Networking algorithms which want to take ownership of the dynamic buffer. Since Beast dynamic buffers are true storage types, they cannot be used directly with functions that take ownership of the dynamic buffer.
This function reads a line of text from a stream into a basic_flat_buffer
, using the net
function async_read_until
.
template <class SyncReadStream> std::size_t read_line (SyncReadStream& stream, flat_buffer& buffer) { return net::read_until(stream, dynamic_buffer_ref(buffer), "\r\n"); }
Name |
Description |
---|---|
|
The dynamic buffer to wrap. Ownership of the buffer is not transferred, the caller is still responsible for managing the lifetime of the original object. |
A wrapper meeting the requirements of DynamicBuffer which references the original dynamic buffer.
Convenience header <boost/beast/core.hpp>