asio C++ library

PrevUpHomeNext

buffer_copy

The asio::buffer_copy function is used to copy bytes from a source buffer (or buffer sequence) to a target buffer (or buffer sequence).

std::size_t buffer_copy(
    const mutable_buffer & target,
    const const_buffer & source);
  » more...

std::size_t buffer_copy(
    const mutable_buffer & target,
    const const_buffers_1 & source);
  » more...

std::size_t buffer_copy(
    const mutable_buffer & target,
    const mutable_buffer & source);
  » more...

std::size_t buffer_copy(
    const mutable_buffer & target,
    const mutable_buffers_1 & source);
  » more...

template<
    typename ConstBufferSequence>
std::size_t buffer_copy(
    const mutable_buffer & target,
    const ConstBufferSequence & source,
    typename enable_if< is_const_buffer_sequence< ConstBufferSequence >::value >::type *  = 0);
  » more...

std::size_t buffer_copy(
    const mutable_buffers_1 & target,
    const const_buffer & source);
  » more...

std::size_t buffer_copy(
    const mutable_buffers_1 & target,
    const const_buffers_1 & source);
  » more...

std::size_t buffer_copy(
    const mutable_buffers_1 & target,
    const mutable_buffer & source);
  » more...

std::size_t buffer_copy(
    const mutable_buffers_1 & target,
    const mutable_buffers_1 & source);
  » more...

template<
    typename ConstBufferSequence>
std::size_t buffer_copy(
    const mutable_buffers_1 & target,
    const ConstBufferSequence & source,
    typename enable_if< is_const_buffer_sequence< ConstBufferSequence >::value >::type *  = 0);
  » more...

template<
    typename MutableBufferSequence>
std::size_t buffer_copy(
    const MutableBufferSequence & target,
    const const_buffer & source,
    typename enable_if< is_mutable_buffer_sequence< MutableBufferSequence >::value >::type *  = 0);
  » more...

template<
    typename MutableBufferSequence>
std::size_t buffer_copy(
    const MutableBufferSequence & target,
    const const_buffers_1 & source,
    typename enable_if< is_mutable_buffer_sequence< MutableBufferSequence >::value >::type *  = 0);
  » more...

template<
    typename MutableBufferSequence>
std::size_t buffer_copy(
    const MutableBufferSequence & target,
    const mutable_buffer & source,
    typename enable_if< is_mutable_buffer_sequence< MutableBufferSequence >::value >::type *  = 0);
  » more...

template<
    typename MutableBufferSequence>
std::size_t buffer_copy(
    const MutableBufferSequence & target,
    const mutable_buffers_1 & source,
    typename enable_if< is_mutable_buffer_sequence< MutableBufferSequence >::value >::type *  = 0);
  » more...

template<
    typename MutableBufferSequence,
    typename ConstBufferSequence>
std::size_t buffer_copy(
    const MutableBufferSequence & target,
    const ConstBufferSequence & source,
    typename enable_if< is_mutable_buffer_sequence< MutableBufferSequence >::value &&is_const_buffer_sequence< ConstBufferSequence >::value >::type *  = 0);
  » more...

std::size_t buffer_copy(
    const mutable_buffer & target,
    const const_buffer & source,
    std::size_t max_bytes_to_copy);
  » more...

std::size_t buffer_copy(
    const mutable_buffer & target,
    const const_buffers_1 & source,
    std::size_t max_bytes_to_copy);
  » more...

std::size_t buffer_copy(
    const mutable_buffer & target,
    const mutable_buffer & source,
    std::size_t max_bytes_to_copy);
  » more...

std::size_t buffer_copy(
    const mutable_buffer & target,
    const mutable_buffers_1 & source,
    std::size_t max_bytes_to_copy);
  » more...

template<
    typename ConstBufferSequence>
std::size_t buffer_copy(
    const mutable_buffer & target,
    const ConstBufferSequence & source,
    std::size_t max_bytes_to_copy,
    typename enable_if< is_const_buffer_sequence< ConstBufferSequence >::value >::type *  = 0);
  » more...

std::size_t buffer_copy(
    const mutable_buffers_1 & target,
    const const_buffer & source,
    std::size_t max_bytes_to_copy);
  » more...

std::size_t buffer_copy(
    const mutable_buffers_1 & target,
    const const_buffers_1 & source,
    std::size_t max_bytes_to_copy);
  » more...

std::size_t buffer_copy(
    const mutable_buffers_1 & target,
    const mutable_buffer & source,
    std::size_t max_bytes_to_copy);
  » more...

std::size_t buffer_copy(
    const mutable_buffers_1 & target,
    const mutable_buffers_1 & source,
    std::size_t max_bytes_to_copy);
  » more...

template<
    typename ConstBufferSequence>
std::size_t buffer_copy(
    const mutable_buffers_1 & target,
    const ConstBufferSequence & source,
    std::size_t max_bytes_to_copy,
    typename enable_if< is_const_buffer_sequence< ConstBufferSequence >::value >::type *  = 0);
  » more...

template<
    typename MutableBufferSequence>
std::size_t buffer_copy(
    const MutableBufferSequence & target,
    const const_buffer & source,
    std::size_t max_bytes_to_copy,
    typename enable_if< is_mutable_buffer_sequence< MutableBufferSequence >::value >::type *  = 0);
  » more...

template<
    typename MutableBufferSequence>
std::size_t buffer_copy(
    const MutableBufferSequence & target,
    const const_buffers_1 & source,
    std::size_t max_bytes_to_copy,
    typename enable_if< is_mutable_buffer_sequence< MutableBufferSequence >::value >::type *  = 0);
  » more...

template<
    typename MutableBufferSequence>
std::size_t buffer_copy(
    const MutableBufferSequence & target,
    const mutable_buffer & source,
    std::size_t max_bytes_to_copy,
    typename enable_if< is_mutable_buffer_sequence< MutableBufferSequence >::value >::type *  = 0);
  » more...

template<
    typename MutableBufferSequence>
std::size_t buffer_copy(
    const MutableBufferSequence & target,
    const mutable_buffers_1 & source,
    std::size_t max_bytes_to_copy,
    typename enable_if< is_mutable_buffer_sequence< MutableBufferSequence >::value >::type *  = 0);
  » more...

template<
    typename MutableBufferSequence,
    typename ConstBufferSequence>
std::size_t buffer_copy(
    const MutableBufferSequence & target,
    const ConstBufferSequence & source,
    std::size_t max_bytes_to_copy,
    typename enable_if< is_mutable_buffer_sequence< MutableBufferSequence >::value &&is_const_buffer_sequence< ConstBufferSequence >::value >::type *  = 0);
  » more...

The buffer_copy function is available in two forms:

Both forms return the number of bytes actually copied. The number of bytes copied is the lesser of:

This prevents buffer overflow, regardless of the buffer sizes used in the copy operation.

Note that buffer_copy is implemented in terms of memcpy, and consequently it cannot be used to copy between overlapping memory regions.

Requirements

Header: asio/buffer.hpp

Convenience header: asio.hpp


PrevUpHomeNext