Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

PrevUpHomeNext

buffer_ref

The buffer ref provides a wrapper around beast buffers to make them usable with asio dynamic_buffer v1.

Synopsis

Defined in header <boost/beast/core/buffer_ref.hpp>

template<
    typename Buffer>
struct buffer_ref
Types

Name

Description

buffer_type

The type of the underlying buffer.

const_buffers_type

The ConstBufferSequence used to represent the readable bytes.

mutable_buffers_type

The MutableBufferSequence used to represent the writable bytes.

Member Functions

Name

Description

buffer_ref [constructor]

Create a buffer reference around buffer.

Copy the reference.

capacity

Return the maximum number of bytes, both readable and writable, that can be held without requiring an allocation.

commit

Move bytes from the output sequence to the input sequence.

consume

Remove n bytes from the readable byte sequence.

data

Returns a constant buffer sequence representing the readable bytes.

max_size

Return the maximum number of bytes, both readable and writable, that can ever be held.

prepare

Get a list of buffers that represents the output sequence, with the given size.

size

Returns the number of readable bytes.

Description

v2 is current not supported, so that BOOST_ASIO_NO_DYNAMIC_BUFFER_V1 mustn't be defined.

Example
asio::tcp::socket sock;
beast::flat_buffer fb;
asio::read_until(sock, ref(fb) '\n' );
Template Parameters

Type

Description

Buffer

The underlying buffer


PrevUpHomeNext