[#boost-urls-url-swap]
= xref:boost.adoc[boost]::xref:boost/urls.adoc[urls]::xref:boost/urls/url.adoc[url]::swap
:relfileprefix: ../../../
:mrdocs:

Swap the contents&period;

== Synopsis

Declared in `&lt;https://www.github.com/boostorg/url/blob/develop/include/boost/url/url.hpp#L363[boost&sol;url&sol;url&period;hpp]&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
void
swap(xref:boost/urls/url.adoc[url]& other) noexcept;
----

== Description

Exchanges the contents of this url with another url&period; All views, iterators and references remain valid&period;

If `this &equals;&equals; &amp;other`, this function call has no effect&period;

== Example

[,cpp]
----
url u1( "https://www.example.com" );
url u2( "https://www.boost.org" );
u1.swap(u2);
assert(u1 == "https://www.boost.org" );
assert(u2 == "https://www.example.com" );
----
== Complexity

Constant

== Exception Safety

Throws nothing&period;

== Parameters

[cols=2]
|===
| Name
| Description
| *other*
| The object to swap with
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
