Clementine
|
Holds a buffer that cannot be modified. More...
#include <buffer.hpp>
Public Member Functions | |
const_buffer () ASIO_NOEXCEPT | |
Construct an empty buffer. | |
const_buffer (const void *data, std::size_t size) ASIO_NOEXCEPT | |
Construct a buffer to represent a given memory range. | |
const_buffer (const mutable_buffer &b) ASIO_NOEXCEPT | |
Construct a non-modifiable buffer from a modifiable one. | |
const void * | data () const ASIO_NOEXCEPT |
Get a pointer to the beginning of the memory range. | |
std::size_t | size () const ASIO_NOEXCEPT |
Get the size of the memory range. | |
const_buffer & | operator+= (std::size_t n) ASIO_NOEXCEPT |
Move the start of the buffer by the specified number of bytes. | |
Related Functions | |
(Note that these are not member functions.) | |
const_buffer | operator+ (const const_buffer &b, std::size_t n) ASIO_NOEXCEPT |
Create a new non-modifiable buffer that is offset from the start of another. | |
const_buffer | operator+ (std::size_t n, const const_buffer &b) ASIO_NOEXCEPT |
Create a new non-modifiable buffer that is offset from the start of another. | |
Holds a buffer that cannot be modified.
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:
The data()
member function permits violations of type safety, so uses of it in application code should be carefully considered.