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

This is the documentation for a snapshot of the develop branch, built from commit 5d35f2afda.
PrevUpHomeNext

mutable_buffer

Holds a buffer that can be modified.

class mutable_buffer
Member Functions

Name

Description

data

Get a pointer to the beginning of the memory range.

mutable_buffer [constructor]

Construct an empty buffer.

Construct a buffer to represent a given memory range.

operator+=

Move the start of the buffer by the specified number of bytes.

size

Get the size of the memory range.

Related Functions

Name

Description

operator+

Create a new modifiable buffer that is offset from the start of another.

The mutable_buffer class provides a safe representation of a buffer that can be modified. It does not own the underlying data, and so is cheap to copy or assign.

Accessing Buffer Contents

The contents of a buffer may be accessed using the data() and size() member functions:

boost::asio::mutable_buffer b1 = ...;
std::size_t s1 = b1.size();
unsigned char* p1 = static_cast<unsigned char*>(b1.data());

The data() member function permits violations of type safety, so uses of it in application code should be carefully considered.

Requirements

Header: boost/asio/buffer.hpp

Convenience header: boost/asio.hpp


PrevUpHomeNext