1<html> 2<head> 3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 4<title>basic_static_string::swap (2 of 2 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="../swap.html" title="basic_static_string::swap"> 9<link rel="prev" href="overload1.html" title="basic_static_string::swap (1 of 2 overloads)"> 10<link rel="next" href="../replace.html" title="basic_static_string::replace"> 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="overload1.html"><img src="../../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../swap.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="../replace.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.swap.overload2"></a><a class="link" href="overload2.html" title="basic_static_string::swap (2 of 2 overloads)">basic_static_string::swap 28 (2 of 2 overloads)</a> 29</h5></div></div></div> 30<p> 31 Swap two strings. 32 </p> 33<h6> 34<a name="static_string.ref.boost__static_strings__basic_static_string.swap.overload2.h0"></a> 35 <span class="phrase"><a name="static_string.ref.boost__static_strings__basic_static_string.swap.overload2.synopsis"></a></span><a class="link" href="overload2.html#static_string.ref.boost__static_strings__basic_static_string.swap.overload2.synopsis">Synopsis</a> 36 </h6> 37<pre class="programlisting"><span class="keyword">template</span><span class="special"><</span> 38 <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">M</span><span class="special">></span> 39<span class="keyword">constexpr</span> <span class="keyword">void</span> 40<span class="identifier">swap</span><span class="special">(</span> 41 <span class="identifier">basic_static_string</span><span class="special"><</span> <span class="identifier">M</span><span class="special">,</span> <span class="identifier">CharT</span><span class="special">,</span> <span class="identifier">Traits</span> <span class="special">>&</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.swap.overload2.h1"></a> 45 <span class="phrase"><a name="static_string.ref.boost__static_strings__basic_static_string.swap.overload2.description"></a></span><a class="link" href="overload2.html#static_string.ref.boost__static_strings__basic_static_string.swap.overload2.description">Description</a> 46 </h6> 47<p> 48 Swaps the contents of the string and <code class="computeroutput"><span class="identifier">s</span></code>. 49 </p> 50<h6> 51<a name="static_string.ref.boost__static_strings__basic_static_string.swap.overload2.h2"></a> 52 <span class="phrase"><a name="static_string.ref.boost__static_strings__basic_static_string.swap.overload2.exception_safety"></a></span><a class="link" href="overload2.html#static_string.ref.boost__static_strings__basic_static_string.swap.overload2.exception_safety">Exception 53 Safety</a> 54 </h6> 55<p> 56 Strong guarantee. 57 </p> 58<h6> 59<a name="static_string.ref.boost__static_strings__basic_static_string.swap.overload2.h3"></a> 60 <span class="phrase"><a name="static_string.ref.boost__static_strings__basic_static_string.swap.overload2.remarks"></a></span><a class="link" href="overload2.html#static_string.ref.boost__static_strings__basic_static_string.swap.overload2.remarks">Remarks</a> 61 </h6> 62<p> 63 All references, pointers, or iterators referring to contained elements 64 are invalidated. Any past-the-end iterators are also invalidated. 65 </p> 66<h6> 67<a name="static_string.ref.boost__static_strings__basic_static_string.swap.overload2.h4"></a> 68 <span class="phrase"><a name="static_string.ref.boost__static_strings__basic_static_string.swap.overload2.template_parameters"></a></span><a class="link" href="overload2.html#static_string.ref.boost__static_strings__basic_static_string.swap.overload2.template_parameters">Template 69 Parameters</a> 70 </h6> 71<div class="informaltable"><table class="table"> 72<colgroup> 73<col> 74<col> 75</colgroup> 76<thead><tr> 77<th> 78 <p> 79 Type 80 </p> 81 </th> 82<th> 83 <p> 84 Description 85 </p> 86 </th> 87</tr></thead> 88<tbody><tr> 89<td> 90 <p> 91 <code class="computeroutput"><span class="identifier">M</span></code> 92 </p> 93 </td> 94<td> 95 <p> 96 The size of the string to swap with. 97 </p> 98 </td> 99</tr></tbody> 100</table></div> 101<h6> 102<a name="static_string.ref.boost__static_strings__basic_static_string.swap.overload2.h5"></a> 103 <span class="phrase"><a name="static_string.ref.boost__static_strings__basic_static_string.swap.overload2.parameters"></a></span><a class="link" href="overload2.html#static_string.ref.boost__static_strings__basic_static_string.swap.overload2.parameters">Parameters</a> 104 </h6> 105<div class="informaltable"><table class="table"> 106<colgroup> 107<col> 108<col> 109</colgroup> 110<thead><tr> 111<th> 112 <p> 113 Name 114 </p> 115 </th> 116<th> 117 <p> 118 Description 119 </p> 120 </th> 121</tr></thead> 122<tbody><tr> 123<td> 124 <p> 125 <code class="computeroutput"><span class="identifier">s</span></code> 126 </p> 127 </td> 128<td> 129 <p> 130 The string to swap with. 131 </p> 132 </td> 133</tr></tbody> 134</table></div> 135<h6> 136<a name="static_string.ref.boost__static_strings__basic_static_string.swap.overload2.h6"></a> 137 <span class="phrase"><a name="static_string.ref.boost__static_strings__basic_static_string.swap.overload2.exceptions"></a></span><a class="link" href="overload2.html#static_string.ref.boost__static_strings__basic_static_string.swap.overload2.exceptions">Exceptions</a> 138 </h6> 139<div class="informaltable"><table class="table"> 140<colgroup> 141<col> 142<col> 143</colgroup> 144<thead><tr> 145<th> 146 <p> 147 Type 148 </p> 149 </th> 150<th> 151 <p> 152 Thrown On 153 </p> 154 </th> 155</tr></thead> 156<tbody><tr> 157<td> 158 <p> 159 <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">length_error</span></code> 160 </p> 161 </td> 162<td> 163 <p> 164 s.size() > <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> 165 || <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> 166 > s.max_size() 167 </p> 168 </td> 169</tr></tbody> 170</table></div> 171</div> 172<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> 173<td align="left"></td> 174<td align="right"><div class="copyright-footer">Copyright © 2019, 2020 Krystian Stasiowski<br>Copyright © 2016-2019 Vinnie 175 Falco<p> 176 Distributed under the Boost Software License, Version 1.0. (See accompanying 177 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>) 178 </p> 179</div></td> 180</tr></table> 181<hr> 182<div class="spirit-nav"> 183<a accesskey="p" href="overload1.html"><img src="../../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../swap.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="../replace.html"><img src="../../../../../../../../doc/src/images/next.png" alt="Next"></a> 184</div> 185</body> 186</html> 187