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

Swap

== Synopsis

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

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

== Description

Exchanges the contents of `v0` with another `v1`&period; All views, iterators and references remain valid&period;

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

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

== Exception Safety
Throws nothing

== Parameters

[cols=2]
|===
| Name
| Description
| *v0*
| The first object to swap
| *v1*
| The second object to swap
|===

== See Also

xref:boost/urls/url/swap.adoc[`url&colon;&colon;swap`]


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