[#BloombergLP-bslstl-Variant_Base-operator_assign-06] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslstl.adoc[bslstl]::xref:BloombergLP/bslstl/Variant_Base.adoc[Variant_Base]::operator= :relfileprefix: ../../../ :mrdocs: Assignment operators == Synopses Declared in `<bslstl_variant.h>` If the specified `rhs` holds the same alternative type as this object, copy assign the contained value of `rhs` to the contained value of this object. Otherwise, destroy the contained value of this object (if any) and, if `rhs` holds a value, copy‐construct the corresponding alternative of this object from the contained value of `rhs`. The allocators of this object and `rhs` both remain unchanged. If the construction of a new alternative object exits via an exception, this `Variant_Base` object is left in a valueless by exception state. This behavior differs from the standard, for reasons that are explained in the documentation for `variant::operator=`. All alternatives shall be copy constructible and copy assignable. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- xref:BloombergLP/bslstl/Variant_Base.adoc[Variant_Base<t_HEAD, t_TAIL...>]& xref:BloombergLP/bslstl/Variant_Base/operator_assign-02.adoc[operator=](xref:BloombergLP/bslstl/Variant_Base.adoc[Variant_Base] const& rhs); ---- [.small]#xref:BloombergLP/bslstl/Variant_Base/operator_assign-02.adoc[_» more..._]# If the specified `rhs` holds the same alternative type as this object, move assign the contained value of `rhs` to the contained value of this object. Otherwise, destroy the currently held alternative object (if any) and, if `rhs` holds a value, move‐construct the corresponding alternative of this object from the contained value of `rhs`. The allocators of this object and `rhs` both remain unchanged. If the construction of a new alternative object exits via an exception, this `Variant_Base` object is left in a valueless by exception state. All alternatives shall be move constructible and move assignable. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- xref:BloombergLP/bslstl/Variant_Base.adoc[Variant_Base<t_HEAD, t_TAIL...>]& xref:BloombergLP/bslstl/Variant_Base/operator_assign-0a.adoc[operator=](xref:BloombergLP/bslmf/MovableRef.adoc[BloombergLP::bslmf::MovableRef<Variant_Base>] rhs); ---- [.small]#xref:BloombergLP/bslstl/Variant_Base/operator_assign-0a.adoc[_» more..._]# [.small]#Created with https://www.mrdocs.com[MrDocs]#