| Home | Libraries | People | FAQ | More

# boost::asio::const_buffer Class Reference

Inherited by boost::asio::const_buffer_container_1.

Inheritance diagram for boost::asio::const_buffer:

List of all members.

## Detailed Description

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.

## Public Member Functions

| const_buffer ()
| Construct an empty buffer.
| const_buffer (const void *data, std::size_t size)
| Construct a buffer to represent a given memory range.
| const_buffer (const mutable_buffer &b)
| Construct a non-modifiable buffer from a modifiable one.

## Related Functions

(Note that these are not member functions.)
template<typename Pointer_To_Pod_Type>
Pointer_To_Pod_Type | buffer_cast (const const_buffer &b)
| Cast a non-modifiable buffer to a specified pointer to POD type.
std::size_t | buffer_size (const const_buffer &b)
| Get the number of bytes in a non-modifiable buffer.
const_buffer | operator+ (const const_buffer &b, std::size_t start)
| Create a new non-modifiable buffer that is offset from the start of another.
const_buffer | operator+ (std::size_t start, const const_buffer &b)
| Create a new non-modifiable buffer that is offset from the start of another.

## Constructor & Destructor Documentation

boost::asio::const_buffer::const_buffer | ( |  | ) |

Construct an empty buffer.

boost::asio::const_buffer::const_buffer | ( | const void * | data,
|  | std::size_t | size |
| ) |  |  |

Construct a buffer to represent a given memory range.

boost::asio::const_buffer::const_buffer | ( | const mutable_buffer & | b | ) |

Construct a non-modifiable buffer from a modifiable one.

## Friends And Related Function Documentation

template<typename Pointer_To_Pod_Type>

Pointer_To_Pod_Type buffer_cast | ( | const const_buffer & | b | ) | `[related]`

Cast a non-modifiable buffer to a specified pointer to POD type.

std::size_t buffer_size | ( | const const_buffer & | b | ) | `[related]`

Get the number of bytes in a non-modifiable buffer.

const_buffer operator+ | ( | const const_buffer & | b,
|  | std::size_t | start |
| ) |  |  | `[related]`

Create a new non-modifiable buffer that is offset from the start of another.

const_buffer operator+ | ( | std::size_t | start,
|  | const const_buffer & | b |
| ) |  |  | `[related]`

Create a new non-modifiable buffer that is offset from the start of another.

| Copyright © 2003 - 2006 Christopher M. Kohlhoff