Boost C++ Libraries

...one 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 to view this page for the latest version.
PrevUpHomeNext

read_size_or_throw

Returns a natural read size or throw if the buffer is full.

Synopsis

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

template<
    class DynamicBuffer>
std::size_t
read_size_or_throw(
    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.

Exceptions

Type

Thrown On

std::length_error

if max_size > 0 and the buffer is full.


PrevUpHomeNext