[#bsl-swap-0f5] = xref:bsl.adoc[bsl]::swap :relfileprefix: ../ :mrdocs: Efficiently exchange the values of the specified `lhs` and `rhs` objects. This method provides the no‐throw guarantee if the two variant objects being swapped have the same active alternative and that alternative provides that guarantee; otherwise, this method provides the basic guarantee. If `lhs` and `rhs` do not contain the same alternative or they have unequal allocators, and an exception is thrown during the swap, either or both variant objects may be left in a valueless state or with an alternative in a moved‐from state. All alternatives shall be move constructible and swappable. For simplicity of implementation, this function differs from the standard in the following : * constraints are not implemented * constexpr is not implemented == Synopsis Declared in `<bslstl_variant.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< class t_HEAD, class... t_TAIL> void swap( xref:bsl/variant.adoc[bsl::variant<t_HEAD, t_TAIL...>]& lhs, xref:bsl/variant.adoc[bsl::variant<t_HEAD, t_TAIL...>]& rhs); ---- [.small]#Created with https://www.mrdocs.com[MrDocs]#