:relfileprefix: ../../../
[#CD8008447DFBF7CCFAB6610CA0558A7E614E7328]

= Friend swap

pass:v,q[Swap]


== Synopsis

Declared in header `</boost/url/url.hpp#L396[boost/url/url.hpp,window=blank_]>`

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

== Description

pass:v,q[Exchanges the contents of `v0` with another `v1`.] pass:v,q[All views, iterators and references remain]
pass:v,q[valid.]
pass:v,q[If `]
pass:v,q[&v]
pass:v,q[0 ==]
pass:v,q[&v]
pass:v,q[1`, this function call has no effect.]

=== 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
pass:v,q[Constant]

=== Exception Safety
pass:v,q[Throws nothing]


