[#bsl-variant-operator_assign-00]
= xref:bsl.adoc[bsl]::xref:bsl/variant.adoc[variant]::operator&equals;
:relfileprefix: ../../
:mrdocs:

Assign to this object the specified `value`&period;

== Synopsis

Declared in `&lt;bslstl&lowbar;variant&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class t&lowbar;TYPE&gt;
xref:bsl/variant.adoc[variant]&
operator&equals;(t&lowbar;TYPE&& value)
requires BloombergLP&colon;&colon;bslstl&colon;&colon;Variant&lowbar;AssignsFromType&lt;variant, t&lowbar;TYPE&gt;&colon;&colon;value;
----

== Description

Assign to this object the specified `value`&period; The alternative corresponding to `value` is the best match among all alternatives for which the expression `t&lowbar;ALT&lowbar;TYPE x&lsqb;&rsqb;&equals; &lcub;std&colon;&colon;forward&lt;t&lowbar;TYPE&gt;(value)&rcub;&semi;` is well formed, and this operator participates in overload resolution only if there is a unique best matching alternative and that alternative is both constructible and assignable from `value`&period; If this `variant` already holds the alternative corresponding to `value`, the contained value is assigned to from `value`&semi; otherwise, any contained value is destroyed and the alternative corresponding to `value` is direct&hyphen;initialized from `value`&period; Note that if the construction of a new alternative object exits via an exception, this `variant` object may be left in a valueless by exception state&period; This is different from the standard, which requires a temporary alternative object to be constructed if such construction is not `noexcept` (see &lsqb;variant&period;assign&rsqb;for details)&period; The standard behavior causes unnecessary performance degradation in cases where the alternative constructor does not throw, yet is not marked `noexcept`&semi; this behavior is therefore not implemented in `bsl&colon;&colon;variant`&period; For simplicity of implementation, this method also differs from the standard in the following ways&colon; &ast; `constexpr` is not implemented &ast; `noexcept` specification is not implemented

== Return Value

reference to this object

== Parameters

[cols="1,4"]
|===
| Name| Description
| *value*
| value to assign to the selected alternative
|===


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