![]() |
(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.
template<
typename PointerToPodType>
PointerToPodType buffer_cast(
const mutable_buffer & b);
» more...
template<
typename PointerToPodType>
PointerToPodType buffer_cast(
const const_buffer & b);
» more...
To access the memory of a non-modifiable buffer, use:
asio::const_buffer b1 = ...; const unsigned char* p1 = asio::buffer_cast<const unsigned char*>(b1);
To access the memory of a modifiable buffer, use:
asio::mutable_buffer b2 = ...; 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.
Header: asio/buffer.hpp
Convenience header: asio.hpp