Imported Upstream version 1.72.0
[platform/upstream/boost.git] / libs / beast / doc / html / beast / ref / boost__beast__buffers_type.html
1 <html>
2 <head>
3 <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
4 <title>buffers_type</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&#160;1.&#160;Boost.Beast">
8 <link rel="up" href="../ref.html" title="This Page Intentionally Left Blank 2/2">
9 <link rel="prev" href="boost__beast__buffers_to_string.html" title="buffers_to_string">
10 <link rel="next" href="boost__beast__close_socket.html" title="close_socket">
11 </head>
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>
20 </tr></table>
21 <hr>
22 <div class="spirit-nav">
23 <a accesskey="p" href="boost__beast__buffers_to_string.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__close_socket.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
24 </div>
25 <div class="section">
26 <div class="titlepage"><div><div><h4 class="title">
27 <a name="beast.ref.boost__beast__buffers_type"></a><a class="link" href="boost__beast__buffers_type.html" title="buffers_type">buffers_type</a>
28 </h4></div></div></div>
29 <p>
30         <a class="indexterm" name="idm45873511495360"></a>
31 Type alias for the underlying buffer type of a list of buffer
32         sequence types.
33       </p>
34 <h5>
35 <a name="beast.ref.boost__beast__buffers_type.h0"></a>
36         <span class="phrase"><a name="beast.ref.boost__beast__buffers_type.synopsis"></a></span><a class="link" href="boost__beast__buffers_type.html#beast.ref.boost__beast__buffers_type.synopsis">Synopsis</a>
37       </h5>
38 <p>
39         Defined in header <code class="literal">&lt;<a href="../../../../../../boost/beast/core/buffer_traits.hpp" target="_top">boost/beast/core/buffer_traits.hpp</a>&gt;</code>
40       </p>
41 <pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</span>
42     <span class="keyword">class</span><span class="special">...</span> <a class="link" href="../concepts/BufferSequence.html" title="BufferSequence"><span class="emphasis"><em>BufferSequence</em></span></a><span class="special">&gt;</span>
43 <span class="keyword">using</span> <span class="identifier">buffers_type</span> <span class="special">=</span> <span class="emphasis"><em>see-below</em></span><span class="special">;</span>
44 </pre>
45 <h5>
46 <a name="beast.ref.boost__beast__buffers_type.h1"></a>
47         <span class="phrase"><a name="beast.ref.boost__beast__buffers_type.description"></a></span><a class="link" href="boost__beast__buffers_type.html#beast.ref.boost__beast__buffers_type.description">Description</a>
48       </h5>
49 <p>
50         This metafunction is used to determine the underlying buffer type for a list
51         of buffer sequence. The equivalent type of the alias will vary depending
52         on the template type argument:
53       </p>
54 <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
55 <li class="listitem">
56             If every type in the list is a <span class="emphasis"><em>MutableBufferSequence</em></span>,
57             the resulting type alias will be <code class="computeroutput"><span class="identifier">net</span><span class="special">::</span><span class="identifier">mutable_buffer</span></code>,
58             otherwise
59           </li>
60 <li class="listitem">
61             The resulting type alias will be <code class="computeroutput"><span class="identifier">net</span><span class="special">::</span><span class="identifier">const_buffer</span></code>.
62           </li>
63 </ul></div>
64 <h5>
65 <a name="beast.ref.boost__beast__buffers_type.h2"></a>
66         <span class="phrase"><a name="beast.ref.boost__beast__buffers_type.example"></a></span><a class="link" href="boost__beast__buffers_type.html#beast.ref.boost__beast__buffers_type.example">Example</a>
67       </h5>
68 <p>
69         The following code returns the first buffer in a buffer sequence, or generates
70         a compilation error if the argument is not a buffer sequence:
71       </p>
72 <pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">BufferSequence</span><span class="special">&gt;</span>
73 <span class="identifier">buffers_type</span> <span class="special">&lt;</span><span class="identifier">BufferSequence</span><span class="special">&gt;</span>
74 <span class="identifier">buffers_front</span> <span class="special">(</span><span class="identifier">BufferSequence</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">buffers</span><span class="special">)</span>
75 <span class="special">{</span>
76     <span class="keyword">static_assert</span><span class="special">(</span>
77         <span class="identifier">net</span><span class="special">::</span><span class="identifier">is_const_buffer_sequence</span><span class="special">&lt;</span><span class="identifier">BufferSequence</span><span class="special">&gt;::</span><span class="identifier">value</span><span class="special">,</span>
78         <span class="string">"BufferSequence type requirements not met"</span><span class="special">);</span>
79     <span class="keyword">auto</span> <span class="keyword">const</span> <span class="identifier">first</span> <span class="special">=</span> <span class="identifier">net</span><span class="special">::</span><span class="identifier">buffer_sequence_begin</span> <span class="special">(</span><span class="identifier">buffers</span><span class="special">);</span>
80     <span class="keyword">if</span> <span class="special">(</span><span class="identifier">first</span> <span class="special">==</span> <span class="identifier">net</span><span class="special">::</span><span class="identifier">buffer_sequence_end</span> <span class="special">(</span><span class="identifier">buffers</span><span class="special">))</span>
81         <span class="keyword">return</span> <span class="special">{};</span>
82     <span class="keyword">return</span> <span class="special">*</span><span class="identifier">first</span><span class="special">;</span>
83 <span class="special">}</span>
84 </pre>
85 <h5>
86 <a name="beast.ref.boost__beast__buffers_type.h3"></a>
87         <span class="phrase"><a name="beast.ref.boost__beast__buffers_type.template_parameters"></a></span><a class="link" href="boost__beast__buffers_type.html#beast.ref.boost__beast__buffers_type.template_parameters">Template
88         Parameters</a>
89       </h5>
90 <div class="informaltable"><table class="table">
91 <colgroup>
92 <col>
93 <col>
94 </colgroup>
95 <thead><tr>
96 <th>
97                 <p>
98                   Type
99                 </p>
100               </th>
101 <th>
102                 <p>
103                   Description
104                 </p>
105               </th>
106 </tr></thead>
107 <tbody><tr>
108 <td>
109                 <p>
110                   <code class="computeroutput"><span class="identifier">BufferSequence</span></code>
111                 </p>
112               </td>
113 <td>
114                 <p>
115                   A list of zero or more types to check. If this list is empty, the
116                   resulting type alias will be <code class="computeroutput"><span class="identifier">net</span><span class="special">::</span><span class="identifier">mutable_buffer</span></code>.
117                 </p>
118               </td>
119 </tr></tbody>
120 </table></div>
121 <p>
122         Convenience header <code class="literal">&lt;<a href="../../../../../../boost/beast/core.hpp" target="_top">boost/beast/core.hpp</a>&gt;</code>
123       </p>
124 </div>
125 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
126 <td align="left"></td>
127 <td align="right"><div class="copyright-footer">Copyright &#169; 2016-2019 Vinnie
128       Falco<p>
129         Distributed under the Boost Software License, Version 1.0. (See accompanying
130         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>)
131       </p>
132 </div></td>
133 </tr></table>
134 <hr>
135 <div class="spirit-nav">
136 <a accesskey="p" href="boost__beast__buffers_to_string.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__close_socket.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
137 </div>
138 </body>
139 </html>