...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
Holds a buffer that can be modified.
class mutable_buffer
Name |
Description |
---|---|
Construct an empty buffer. Construct a buffer to represent a given memory range. |
Name |
Description |
---|---|
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.
The contents of a buffer may be accessed using the buffer_size
and buffer_cast
functions:
boost::asio::mutable_buffer b1 = ...; std::size_t s1 = boost::asio::buffer_size(b1); unsigned char* p1 = boost::asio::buffer_cast<unsigned char*>(b1);
The boost::asio::buffer_cast
function permits violations
of type safety, so uses of it in application code should be carefully considered.
Header: boost/asio/buffer.hpp
Convenience header: boost/asio.hpp