| Home | Libraries | People | FAQ | More

#### read_size

Returns a natural read size.

##### Synopsis

Defined in header `<boost/beast/core/read_size.hpp>`

    template<
        class DynamicBuffer>
    std::size_t
    read_size(
        DynamicBuffer& buffer,
        std::size_t max_size);

##### Description

This function inspects the capacity, size, and maximum size of the dynamic buffer. Then it computes a natural read size given the passed-in upper limit. It favors a read size that does not require a reallocation, subject to a reasonable minimum to avoid tiny reads.

##### Parameters

Name | Description
--- | ---
`buffer` | The dynamic buffer to inspect.
`max_size` | An upper limit on the returned value.

##### Remarks

If the buffer is already at its maximum size, zero is returned.

Convenience header `<boost/beast/core.hpp>`