[#bsl-optional-072-operator_assign-01]
= xref:bsl.adoc[bsl]::xref:bsl/optional-072.adoc[optional]::operator&equals;
:relfileprefix: ../../
:mrdocs:

Assignment operators

== Synopses

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

Assign to this object the value of the specified `rhs` object, and return a non&hyphen;`const` reference to this object&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:BloombergLP/bslstl/Optional_Base-05.adoc[Optional&lowbar;Base&lt;t&lowbar;TYPE, t&lowbar;USES&lowbar;BSLMA&lowbar;ALLOC&gt;]&
xref:BloombergLP/bslstl/Optional_Base-05/operator_assign-05.adoc[operator&equals;](xref:BloombergLP/bslstl/Optional_Base-05.adoc[Optional&lowbar;Base] const& rhs);
----

[.small]#xref:BloombergLP/bslstl/Optional_Base-05/operator_assign-05.adoc[_» more&period;&period;&period;_]#

Assign a new value to this optional&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class t&lowbar;ANY&lowbar;TYPE&gt;
constexpr
xref:bsl/optional-072.adoc[optional&lt;t&lowbar;TYPE&gt;]&
xref:bsl/optional-072/operator_assign-08.adoc[operator&equals;](xref:bsl/optional-072.adoc[optional&lt;t&lowbar;ANY&lowbar;TYPE&gt;] const& rhs);
----

[.small]#xref:bsl/optional-072/operator_assign-08.adoc[_» more&period;&period;&period;_]#

Assign a new value to this optional&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
constexpr
xref:bsl/optional-072.adoc[optional&lt;t&lowbar;TYPE&gt;]&
xref:bsl/optional-072/operator_assign-09.adoc[operator&equals;](xref:bsl/nullopt_t.adoc[bsl::nullopt&lowbar;t] nullopt) noexcept;
----

[.small]#xref:bsl/optional-072/operator_assign-09.adoc[_» more&period;&period;&period;_]#

Assign a new value to this optional&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:BloombergLP/bslstl/Optional_Base-05.adoc[Optional&lowbar;Base&lt;t&lowbar;TYPE, t&lowbar;USES&lowbar;BSLMA&lowbar;ALLOC&gt;]&
xref:BloombergLP/bslstl/Optional_Base-05/operator_assign-08.adoc[operator&equals;](xref:BloombergLP/bslmf/MovableRef.adoc[BloombergLP::bslmf::MovableRef&lt;Optional&lowbar;Base&gt;] rhs);
----

[.small]#xref:BloombergLP/bslstl/Optional_Base-05/operator_assign-08.adoc[_» more&period;&period;&period;_]#

Assign a new value to this optional&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class t&lowbar;ANY&lowbar;TYPE&gt;
constexpr
xref:bsl/optional-072.adoc[optional&lt;t&lowbar;TYPE&gt;]&
xref:bsl/optional-072/operator_assign-0f.adoc[operator&equals;](xref:BloombergLP/bslmf/MovableRef_Deduced.adoc[BloombergLP::bslmf::MovableRef&lowbar;Deduced&lt;optional&lt;t&lowbar;ANY&lowbar;TYPE&gt;&gt;] rhs);
----

[.small]#xref:bsl/optional-072/operator_assign-0f.adoc[_» more&period;&period;&period;_]#

Assign a new value to this optional&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class t&lowbar;ANY&lowbar;TYPE = t&lowbar;TYPE&gt;
constexpr
xref:bsl/optional-072.adoc[optional&lt;t&lowbar;TYPE&gt;]&
xref:bsl/optional-072/operator_assign-06.adoc[operator&equals;](std::optional&lt;t&lowbar;ANY&lowbar;TYPE&gt; const& rhs);
----

[.small]#xref:bsl/optional-072/operator_assign-06.adoc[_» more&period;&period;&period;_]#

Assign a new value to this optional&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class t&lowbar;ANY&lowbar;TYPE = t&lowbar;TYPE&gt;
constexpr
xref:bsl/optional-072.adoc[optional&lt;t&lowbar;TYPE&gt;]&
xref:bsl/optional-072/operator_assign-0d.adoc[operator&equals;](t&lowbar;ANY&lowbar;TYPE&& rhs);
----

[.small]#xref:bsl/optional-072/operator_assign-0d.adoc[_» more&period;&period;&period;_]#

Assign a new value to this optional&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class t&lowbar;ANY&lowbar;TYPE = t&lowbar;TYPE&gt;
constexpr
xref:bsl/optional-072.adoc[optional&lt;t&lowbar;TYPE&gt;]&
xref:bsl/optional-072/operator_assign-0e.adoc[operator&equals;](std::optional&lt;t&lowbar;ANY&lowbar;TYPE&gt;&& rhs);
----

[.small]#xref:bsl/optional-072/operator_assign-0e.adoc[_» more&period;&period;&period;_]#

== Return Value

reference providing modifiable access to this object

== Parameters

[cols="1,4"]
|===
| Name| Description
| *rhs*
| right&hyphen;hand operand
| *nullopt*
| disengaged&hyphen;optional tag&semi; value is unused
|===


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