Clementine
Public Member Functions | Related Functions | List of all members
asio::mutable_buffer Class Reference

Holds a buffer that can be modified. More...

#include <buffer.hpp>

Inheritance diagram for asio::mutable_buffer:
Inheritance graph
[legend]

Public Member Functions

 mutable_buffer () ASIO_NOEXCEPT
 Construct an empty buffer.
 
 mutable_buffer (void *data, std::size_t size) ASIO_NOEXCEPT
 Construct a buffer to represent a given memory range.
 
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.
 
mutable_bufferoperator+= (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.)

mutable_buffer operator+ (const mutable_buffer &b, std::size_t n) ASIO_NOEXCEPT
 Create a new modifiable buffer that is offset from the start of another.
 
mutable_buffer operator+ (std::size_t n, const mutable_buffer &b) ASIO_NOEXCEPT
 Create a new modifiable buffer that is offset from the start of another.
 

Detailed Description

Holds a buffer that can be modified.

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:

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.


The documentation for this class was generated from the following file: