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 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__buffers_to_string.html" title="buffers_to_string">
10 <link rel="next" href="boost__beast__close_socket.html" title="close_socket">
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__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>
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>
30 <a class="indexterm" name="idm45873511495360"></a>
31 Type alias for the underlying buffer type of a list of buffer
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>
39 Defined in header <code class="literal"><<a href="../../../../../../boost/beast/core/buffer_traits.hpp" target="_top">boost/beast/core/buffer_traits.hpp</a>></code>
41 <pre class="programlisting"><span class="keyword">template</span><span class="special"><</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">></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>
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>
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:
54 <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
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>,
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>.
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>
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:
72 <pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">BufferSequence</span><span class="special">></span>
73 <span class="identifier">buffers_type</span> <span class="special"><</span><span class="identifier">BufferSequence</span><span class="special">></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">&</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"><</span><span class="identifier">BufferSequence</span><span class="special">>::</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>
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
90 <div class="informaltable"><table class="table">
110 <code class="computeroutput"><span class="identifier">BufferSequence</span></code>
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>.
122 Convenience header <code class="literal"><<a href="../../../../../../boost/beast/core.hpp" target="_top">boost/beast/core.hpp</a>></code>
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 © 2016-2019 Vinnie
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>)
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>