Boost C++ Libraries of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of boost. Click here for the latest Boost documentation.

buffer_copy (16 of 30 overloads)

Copies a limited number of bytes from a source buffer to a target buffer.

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


A modifiable buffer representing the memory region to which the bytes will be copied.


A non-modifiable buffer representing the memory region from which the bytes will be copied.


The maximum number of bytes to be copied.

Return Value

The number of bytes copied.


The number of bytes copied is the lesser of:

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