• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<html>
2<head>
3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
4<title>mutable_buffer</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="../../boost_asio.html" title="Boost.Asio">
8<link rel="up" href="../reference.html" title="Reference">
9<link rel="prev" href="multiple_exceptions/what.html" title="multiple_exceptions::what">
10<link rel="next" href="mutable_buffer/data.html" title="mutable_buffer::data">
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="multiple_exceptions/what.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../boost_asio.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="mutable_buffer/data.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
24</div>
25<div class="section">
26<div class="titlepage"><div><div><h3 class="title">
27<a name="boost_asio.reference.mutable_buffer"></a><a class="link" href="mutable_buffer.html" title="mutable_buffer">mutable_buffer</a>
28</h3></div></div></div>
29<p>
30        Holds a buffer that can be modified.
31      </p>
32<pre class="programlisting">class mutable_buffer
33</pre>
34<h5>
35<a name="boost_asio.reference.mutable_buffer.h0"></a>
36        <span class="phrase"><a name="boost_asio.reference.mutable_buffer.member_functions"></a></span><a class="link" href="mutable_buffer.html#boost_asio.reference.mutable_buffer.member_functions">Member Functions</a>
37      </h5>
38<div class="informaltable"><table class="table">
39<colgroup>
40<col>
41<col>
42</colgroup>
43<thead><tr>
44<th>
45                <p>
46                  Name
47                </p>
48              </th>
49<th>
50                <p>
51                  Description
52                </p>
53              </th>
54</tr></thead>
55<tbody>
56<tr>
57<td>
58                <p>
59                  <a class="link" href="mutable_buffer/data.html" title="mutable_buffer::data"><span class="bold"><strong>data</strong></span></a>
60                </p>
61              </td>
62<td>
63                <p>
64                  Get a pointer to the beginning of the memory range.
65                </p>
66              </td>
67</tr>
68<tr>
69<td>
70                <p>
71                  <a class="link" href="mutable_buffer/mutable_buffer.html" title="mutable_buffer::mutable_buffer"><span class="bold"><strong>mutable_buffer</strong></span></a> <span class="silver">[constructor]</span>
72                </p>
73              </td>
74<td>
75                <p>
76                  Construct an empty buffer. <br> <span class="silver"> —</span><br> Construct a buffer to
77                  represent a given memory range.
78                </p>
79              </td>
80</tr>
81<tr>
82<td>
83                <p>
84                  <a class="link" href="mutable_buffer/operator_plus__eq_.html" title="mutable_buffer::operator+="><span class="bold"><strong>operator+=</strong></span></a>
85                </p>
86              </td>
87<td>
88                <p>
89                  Move the start of the buffer by the specified number of bytes.
90                </p>
91              </td>
92</tr>
93<tr>
94<td>
95                <p>
96                  <a class="link" href="mutable_buffer/size.html" title="mutable_buffer::size"><span class="bold"><strong>size</strong></span></a>
97                </p>
98              </td>
99<td>
100                <p>
101                  Get the size of the memory range.
102                </p>
103              </td>
104</tr>
105</tbody>
106</table></div>
107<h5>
108<a name="boost_asio.reference.mutable_buffer.h1"></a>
109        <span class="phrase"><a name="boost_asio.reference.mutable_buffer.related_functions"></a></span><a class="link" href="mutable_buffer.html#boost_asio.reference.mutable_buffer.related_functions">Related Functions</a>
110      </h5>
111<div class="informaltable"><table class="table">
112<colgroup>
113<col>
114<col>
115</colgroup>
116<thead><tr>
117<th>
118                <p>
119                  Name
120                </p>
121              </th>
122<th>
123                <p>
124                  Description
125                </p>
126              </th>
127</tr></thead>
128<tbody><tr>
129<td>
130                <p>
131                  <a class="link" href="mutable_buffer/operator_plus_.html" title="mutable_buffer::operator+"><span class="bold"><strong>operator+</strong></span></a>
132                </p>
133              </td>
134<td>
135                <p>
136                  Create a new modifiable buffer that is offset from the start of
137                  another.
138                </p>
139              </td>
140</tr></tbody>
141</table></div>
142<p>
143        The <a class="link" href="mutable_buffer.html" title="mutable_buffer"><code class="computeroutput">mutable_buffer</code></a>
144        class provides a safe representation of a buffer that can be modified. It
145        does not own the underlying data, and so is cheap to copy or assign.
146      </p>
147<h5>
148<a name="boost_asio.reference.mutable_buffer.h2"></a>
149        <span class="phrase"><a name="boost_asio.reference.mutable_buffer.accessing_buffer_contents"></a></span><a class="link" href="mutable_buffer.html#boost_asio.reference.mutable_buffer.accessing_buffer_contents">Accessing
150        Buffer Contents</a>
151      </h5>
152<p>
153        The contents of a buffer may be accessed using the <code class="computeroutput">data()</code> and
154        <code class="computeroutput">size()</code> member functions:
155      </p>
156<pre class="programlisting">boost::asio::mutable_buffer b1 = ...;
157std::size_t s1 = b1.size();
158unsigned char* p1 = static_cast&lt;unsigned char*&gt;(b1.data());
159</pre>
160<p>
161        The <code class="computeroutput">data()</code> member function permits violations of type safety,
162        so uses of it in application code should be carefully considered.
163      </p>
164<h5>
165<a name="boost_asio.reference.mutable_buffer.h3"></a>
166        <span class="phrase"><a name="boost_asio.reference.mutable_buffer.requirements"></a></span><a class="link" href="mutable_buffer.html#boost_asio.reference.mutable_buffer.requirements">Requirements</a>
167      </h5>
168<p>
169        <span class="emphasis"><em>Header: </em></span><code class="literal">boost/asio/buffer.hpp</code>
170      </p>
171<p>
172        <span class="emphasis"><em>Convenience header: </em></span><code class="literal">boost/asio.hpp</code>
173      </p>
174</div>
175<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
176<td align="left"></td>
177<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
178      Kohlhoff<p>
179        Distributed under the Boost Software License, Version 1.0. (See accompanying
180        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>)
181      </p>
182</div></td>
183</tr></table>
184<hr>
185<div class="spirit-nav">
186<a accesskey="p" href="multiple_exceptions/what.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../boost_asio.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="mutable_buffer/data.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
187</div>
188</body>
189</html>
190