Clementine
Functions
asio::buffer_cast

(Deprecated: Use the data() member function.) The asio::buffer_cast function is used to obtain a pointer to the underlying memory region associated with a buffer. More...

Functions

template<typename PointerToPodType >
PointerToPodType asio::buffer_cast (const mutable_buffer &b) ASIO_NOEXCEPT
 Cast a non-modifiable buffer to a specified pointer to POD type.
 
template<typename PointerToPodType >
PointerToPodType asio::buffer_cast (const const_buffer &b) ASIO_NOEXCEPT
 Cast a non-modifiable buffer to a specified pointer to POD type.
 

Detailed Description

(Deprecated: Use the data() member function.) The asio::buffer_cast function is used to obtain a pointer to the underlying memory region associated with a buffer.

Examples:

To access the memory of a non-modifiable buffer, use:

const unsigned char* p1 = asio::buffer_cast<const unsigned char*>(b1);

To access the memory of a modifiable buffer, use:

unsigned char* p2 = asio::buffer_cast<unsigned char*>(b2);

The asio::buffer_cast function permits violations of type safety, so uses of it in application code should be carefully considered.