Holds a buffer that cannot be modified.
class const_buffer
Name |
Description |
---|---|
Construct an empty buffer. Construct a buffer to represent a given memory range. Construct a non-modifiable buffer from a modifiable one. |
Name |
Description |
---|---|
Create a new non-modifiable buffer that is offset from the start of another. |
The const_buffer
class provides a safe representation of a buffer that cannot 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:
asio::const_buffer b1 = ...; std::size_t s1 = asio::buffer_size(b1); const unsigned char* p1 = asio::buffer_cast<const unsigned char*>(b1);
The asio::buffer_cast
function permits violations
of type safety, so uses of it in application code should be carefully considered.
Header: asio/buffer.hpp
Convenience header: asio.hpp