• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<html>
2<head>
3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
4<title>basic_static_string::replace (6 of 14 overloads)</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="Boost.StaticString">
8<link rel="up" href="../replace.html" title="basic_static_string::replace">
9<link rel="prev" href="overload5.html" title="basic_static_string::replace (5 of 14 overloads)">
10<link rel="next" href="overload7.html" title="basic_static_string::replace (7 of 14 overloads)">
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="overload5.html"><img src="../../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../replace.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="overload7.html"><img src="../../../../../../../../doc/src/images/next.png" alt="Next"></a>
24</div>
25<div class="section">
26<div class="titlepage"><div><div><h5 class="title">
27<a name="static_string.ref.boost__static_strings__basic_static_string.replace.overload6"></a><a class="link" href="overload6.html" title="basic_static_string::replace (6 of 14 overloads)">basic_static_string::replace
28          (6 of 14 overloads)</a>
29</h5></div></div></div>
30<p>
31            Replace a part of the string.
32          </p>
33<h6>
34<a name="static_string.ref.boost__static_strings__basic_static_string.replace.overload6.h0"></a>
35            <span class="phrase"><a name="static_string.ref.boost__static_strings__basic_static_string.replace.overload6.synopsis"></a></span><a class="link" href="overload6.html#static_string.ref.boost__static_strings__basic_static_string.replace.overload6.synopsis">Synopsis</a>
36          </h6>
37<pre class="programlisting"><span class="keyword">constexpr</span> <span class="identifier">basic_static_string</span><span class="special">&amp;</span>
38<span class="identifier">replace</span><span class="special">(</span>
39    <span class="identifier">size_type</span> <span class="identifier">pos</span><span class="special">,</span>
40    <span class="identifier">size_type</span> <span class="identifier">n1</span><span class="special">,</span>
41    <span class="identifier">const_pointer</span> <span class="identifier">s</span><span class="special">);</span>
42</pre>
43<h6>
44<a name="static_string.ref.boost__static_strings__basic_static_string.replace.overload6.h1"></a>
45            <span class="phrase"><a name="static_string.ref.boost__static_strings__basic_static_string.replace.overload6.description"></a></span><a class="link" href="overload6.html#static_string.ref.boost__static_strings__basic_static_string.replace.overload6.description">Description</a>
46          </h6>
47<p>
48            Replaces <code class="computeroutput"><span class="identifier">rcount</span></code> characters
49            starting at index <code class="computeroutput"><span class="identifier">pos</span></code>
50            with those of <code class="computeroutput"><span class="special">{</span><span class="identifier">s</span><span class="special">,</span> <span class="identifier">s</span> <span class="special">+</span> <span class="identifier">len</span><span class="special">)</span></code>, where the length of the string <code class="computeroutput"><span class="identifier">len</span></code> is <code class="computeroutput"><span class="identifier">traits_type</span><span class="special">::</span><span class="identifier">length</span><span class="special">(</span><span class="identifier">s</span><span class="special">)</span></code> and <code class="computeroutput"><span class="identifier">rcount</span></code>
51            is std::min(n1, <a class="link" href="../size.html" title="basic_static_string::size"><code class="computeroutput"><span class="identifier">size</span><span class="special">()</span></code></a>
52            - pos).
53          </p>
54<h6>
55<a name="static_string.ref.boost__static_strings__basic_static_string.replace.overload6.h2"></a>
56            <span class="phrase"><a name="static_string.ref.boost__static_strings__basic_static_string.replace.overload6.exception_safety"></a></span><a class="link" href="overload6.html#static_string.ref.boost__static_strings__basic_static_string.replace.overload6.exception_safety">Exception
57            Safety</a>
58          </h6>
59<p>
60            Strong guarantee.
61          </p>
62<h6>
63<a name="static_string.ref.boost__static_strings__basic_static_string.replace.overload6.h3"></a>
64            <span class="phrase"><a name="static_string.ref.boost__static_strings__basic_static_string.replace.overload6.remarks"></a></span><a class="link" href="overload6.html#static_string.ref.boost__static_strings__basic_static_string.replace.overload6.remarks">Remarks</a>
65          </h6>
66<p>
67            All references, pointers, or iterators referring to contained elements
68            are invalidated. Any past-the-end iterators are also invalidated.
69          </p>
70<h6>
71<a name="static_string.ref.boost__static_strings__basic_static_string.replace.overload6.h4"></a>
72            <span class="phrase"><a name="static_string.ref.boost__static_strings__basic_static_string.replace.overload6.return_value"></a></span><a class="link" href="overload6.html#static_string.ref.boost__static_strings__basic_static_string.replace.overload6.return_value">Return
73            Value</a>
74          </h6>
75<p>
76            <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span></code>
77          </p>
78<h6>
79<a name="static_string.ref.boost__static_strings__basic_static_string.replace.overload6.h5"></a>
80            <span class="phrase"><a name="static_string.ref.boost__static_strings__basic_static_string.replace.overload6.parameters"></a></span><a class="link" href="overload6.html#static_string.ref.boost__static_strings__basic_static_string.replace.overload6.parameters">Parameters</a>
81          </h6>
82<div class="informaltable"><table class="table">
83<colgroup>
84<col>
85<col>
86</colgroup>
87<thead><tr>
88<th>
89                    <p>
90                      Name
91                    </p>
92                  </th>
93<th>
94                    <p>
95                      Description
96                    </p>
97                  </th>
98</tr></thead>
99<tbody>
100<tr>
101<td>
102                    <p>
103                      <code class="computeroutput"><span class="identifier">pos</span></code>
104                    </p>
105                  </td>
106<td>
107                    <p>
108                      The index to replace at.
109                    </p>
110                  </td>
111</tr>
112<tr>
113<td>
114                    <p>
115                      <code class="computeroutput"><span class="identifier">n1</span></code>
116                    </p>
117                  </td>
118<td>
119                    <p>
120                      The number of characters to replace.
121                    </p>
122                  </td>
123</tr>
124<tr>
125<td>
126                    <p>
127                      <code class="computeroutput"><span class="identifier">s</span></code>
128                    </p>
129                  </td>
130<td>
131                    <p>
132                      The string to replace with.
133                    </p>
134                  </td>
135</tr>
136</tbody>
137</table></div>
138<h6>
139<a name="static_string.ref.boost__static_strings__basic_static_string.replace.overload6.h6"></a>
140            <span class="phrase"><a name="static_string.ref.boost__static_strings__basic_static_string.replace.overload6.exceptions"></a></span><a class="link" href="overload6.html#static_string.ref.boost__static_strings__basic_static_string.replace.overload6.exceptions">Exceptions</a>
141          </h6>
142<div class="informaltable"><table class="table">
143<colgroup>
144<col>
145<col>
146</colgroup>
147<thead><tr>
148<th>
149                    <p>
150                      Type
151                    </p>
152                  </th>
153<th>
154                    <p>
155                      Thrown On
156                    </p>
157                  </th>
158</tr></thead>
159<tbody>
160<tr>
161<td>
162                    <p>
163                      <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">length_error</span></code>
164                    </p>
165                  </td>
166<td>
167                    <p>
168                      <a class="link" href="../size.html" title="basic_static_string::size"><code class="computeroutput"><span class="identifier">size</span><span class="special">()</span></code></a>
169                      + (len - rcount) &gt; <a class="link" href="../max_size.html" title="basic_static_string::max_size"><code class="computeroutput"><span class="identifier">max_size</span><span class="special">()</span></code></a>
170                    </p>
171                  </td>
172</tr>
173<tr>
174<td>
175                    <p>
176                      <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">out_of_range</span></code>
177                    </p>
178                  </td>
179<td>
180                    <p>
181                      pos &gt; <a class="link" href="../size.html" title="basic_static_string::size"><code class="computeroutput"><span class="identifier">size</span><span class="special">()</span></code></a>
182                    </p>
183                  </td>
184</tr>
185</tbody>
186</table></div>
187</div>
188<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
189<td align="left"></td>
190<td align="right"><div class="copyright-footer">Copyright © 2019, 2020 Krystian Stasiowski<br>Copyright © 2016-2019 Vinnie
191      Falco<p>
192        Distributed under the Boost Software License, Version 1.0. (See accompanying
193        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>)
194      </p>
195</div></td>
196</tr></table>
197<hr>
198<div class="spirit-nav">
199<a accesskey="p" href="overload5.html"><img src="../../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../replace.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="overload7.html"><img src="../../../../../../../../doc/src/images/next.png" alt="Next"></a>
200</div>
201</body>
202</html>
203