3 <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
4 <title>read_size_or_throw</title>
5 <link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css">
6 <meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
7 <link rel="home" href="../../index.html" title="Chapter 1. Boost.Beast">
8 <link rel="up" href="../ref.html" title="This Page Intentionally Left Blank 2/2">
9 <link rel="prev" href="boost__beast__read_size.html" title="read_size">
10 <link rel="next" href="boost__beast__role_type.html" title="role_type">
12 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
13 <table cellpadding="2" width="100%"><tr>
14 <td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
15 <td align="center"><a href="../../../../../../index.html">Home</a></td>
16 <td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td>
17 <td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
18 <td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
19 <td align="center"><a href="../../../../../../more/index.htm">More</a></td>
22 <div class="spirit-nav">
23 <a accesskey="p" href="boost__beast__read_size.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../ref.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="boost__beast__role_type.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
26 <div class="titlepage"><div><div><h4 class="title">
27 <a name="beast.ref.boost__beast__read_size_or_throw"></a><a class="link" href="boost__beast__read_size_or_throw.html" title="read_size_or_throw">read_size_or_throw</a>
28 </h4></div></div></div>
30 <a class="indexterm" name="idm45873485572464"></a>
31 Returns a natural read size or throw if the buffer is full.
34 <a name="beast.ref.boost__beast__read_size_or_throw.h0"></a>
35 <span class="phrase"><a name="beast.ref.boost__beast__read_size_or_throw.synopsis"></a></span><a class="link" href="boost__beast__read_size_or_throw.html#beast.ref.boost__beast__read_size_or_throw.synopsis">Synopsis</a>
38 Defined in header <code class="literal"><<a href="../../../../../../boost/beast/core/read_size.hpp" target="_top">boost/beast/core/read_size.hpp</a>></code>
40 <pre class="programlisting"><span class="keyword">template</span><span class="special"><</span>
41 <span class="keyword">class</span> <a class="link" href="../concepts/DynamicBuffer.html" title="DynamicBuffer"><span class="emphasis"><em>DynamicBuffer</em></span></a><span class="special">></span>
42 <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span>
43 <span class="identifier">read_size_or_throw</span><span class="special">(</span>
44 <span class="identifier">DynamicBuffer</span><span class="special">&</span> <span class="identifier">buffer</span><span class="special">,</span>
45 <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">max_size</span><span class="special">);</span>
48 <a name="beast.ref.boost__beast__read_size_or_throw.h1"></a>
49 <span class="phrase"><a name="beast.ref.boost__beast__read_size_or_throw.description"></a></span><a class="link" href="boost__beast__read_size_or_throw.html#beast.ref.boost__beast__read_size_or_throw.description">Description</a>
52 This function inspects the capacity, size, and maximum size of the dynamic
53 buffer. Then it computes a natural read size given the passed-in upper limit.
54 It favors a read size that does not require a reallocation, subject to a
55 reasonable minimum to avoid tiny reads.
58 <a name="beast.ref.boost__beast__read_size_or_throw.h2"></a>
59 <span class="phrase"><a name="beast.ref.boost__beast__read_size_or_throw.parameters"></a></span><a class="link" href="boost__beast__read_size_or_throw.html#beast.ref.boost__beast__read_size_or_throw.parameters">Parameters</a>
61 <div class="informaltable"><table class="table">
82 <code class="computeroutput"><span class="identifier">buffer</span></code>
87 The dynamic buffer to inspect.
94 <code class="computeroutput"><span class="identifier">max_size</span></code>
99 An upper limit on the returned value.
106 <a name="beast.ref.boost__beast__read_size_or_throw.h3"></a>
107 <span class="phrase"><a name="beast.ref.boost__beast__read_size_or_throw.exceptions"></a></span><a class="link" href="boost__beast__read_size_or_throw.html#beast.ref.boost__beast__read_size_or_throw.exceptions">Exceptions</a>
109 <div class="informaltable"><table class="table">
129 <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">length_error</span></code>
134 if <code class="computeroutput"><span class="identifier">max_size</span> <span class="special">></span>
135 <span class="number">0</span></code> and the buffer is full.
141 Convenience header <code class="literal"><<a href="../../../../../../boost/beast/core.hpp" target="_top">boost/beast/core.hpp</a>></code>
144 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
145 <td align="left"></td>
146 <td align="right"><div class="copyright-footer">Copyright © 2016-2019 Vinnie
148 Distributed under the Boost Software License, Version 1.0. (See accompanying
149 file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
154 <div class="spirit-nav">
155 <a accesskey="p" href="boost__beast__read_size.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../ref.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="boost__beast__role_type.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>