Networking TS

PrevUpHomeNext

buffer_copy

The std::experimental::net::v1::buffer_copy function is used to copy bytes from a source buffer (or buffer sequence) to a target buffer (or buffer sequence).

template<
    typename MutableBufferSequence,
    typename ConstBufferSequence>
std::size_t buffer_copy(
    const MutableBufferSequence & target,
    const ConstBufferSequence & source);
  » more...

template<
    typename MutableBufferSequence,
    typename ConstBufferSequence>
std::size_t buffer_copy(
    const MutableBufferSequence & target,
    const ConstBufferSequence & source,
    std::size_t max_bytes_to_copy);
  » 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.


PrevUpHomeNext