Home | Libraries | People | FAQ | More |
Holds a buffer that cannot be modified.
class const_buffer
Name |
Description |
---|---|
Construct an empty buffer. |
|
Get a pointer to the beginning of the memory range. |
|
Move the start of the buffer by the specified number of bytes. |
|
Get the size of the memory range. |
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 data()
and
size()
member functions:
boost::asio::const_buffer b1 = ...; std::size_t s1 = b1.size(); const unsigned char* p1 = static_cast<const unsigned char*>(b1.data());
The data()
member 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