[#BloombergLP-bdlb-NullableValue-operator_assign-087]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdlb.adoc[bdlb]::xref:BloombergLP/bdlb/NullableValue.adoc[NullableValue]::operator&equals;
:relfileprefix: ../../../
:mrdocs:

Assignment operators

== Synopses

Declared in `&lt;bdlb&lowbar;nullablevalue&period;h&gt;`

Assign to this object the value of the specified `rhs`, and return a reference providing modifiable access to this object&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:BloombergLP/bdlb/NullableValue.adoc[NullableValue&lt;TYPE&gt;]&
xref:BloombergLP/bdlb/NullableValue/operator_assign-038.adoc[operator&equals;](xref:BloombergLP/bdlb/NullableValue.adoc[NullableValue] const& rhs);
----

[.small]#xref:BloombergLP/bdlb/NullableValue/operator_assign-038.adoc[_» more&period;&period;&period;_]#

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 to this object the null value if the specified `rhs` object is null, and the value of `rhs&period;value()` (of `BDE&lowbar;OTHER&lowbar;TYPE`) converted to `TYPE` otherwise&period; Return a reference providing modifiable access to this object&period; Note that this method will fail to compile if `TYPE` and &grave;BDE&lowbar;OTHER&lowbar;TYPE&apos; are not compatible&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class BDE&lowbar;OTHER&lowbar;TYPE&gt;
xref:BloombergLP/bdlb/NullableValue.adoc[NullableValue&lt;TYPE&gt;]&
xref:BloombergLP/bdlb/NullableValue/operator_assign-00b.adoc[operator&equals;](xref:BloombergLP/bdlb/NullableValue.adoc[NullableValue&lt;BDE&lowbar;OTHER&lowbar;TYPE&gt;] const& rhs);
----

[.small]#xref:BloombergLP/bdlb/NullableValue/operator_assign-00b.adoc[_» more&period;&period;&period;_]#

Disengage this object if the specified `rhs` object is disengaged, and assign to this object the value of `rhs&period;value()` (of `t&lowbar;ANY&lowbar;TYPE`) converted to `t&lowbar;TYPE` otherwise&period; Return a reference providing modifiable access to this object&period; Note that this method does not participate in overload resolution unless `t&lowbar;TYPE` and `t&lowbar;ANY&lowbar;TYPE` are compatible&period; This assignment operator can be called in constant expressions only when neither `t&lowbar;TYPE` nor `t&lowbar;ANY&lowbar;TYPE` is allocator&hyphen;aware&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;_]#

Reset this object to be disengaged and return a reference providing modifiable access to this object&period; This assignment operator can be called in constant expressions only when `t&lowbar;TYPE` is not allocator&hyphen;aware&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]) noexcept;
----

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

Assign to this object the value of the specified `rhs`, and return a reference providing modifiable access to this object&period; The contents of `rhs` are either move&hyphen;inserted into or move&hyphen;assigned to this object&period; `rhs` is left in a valid but unspecified state&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:BloombergLP/bdlb/NullableValue.adoc[NullableValue&lt;TYPE&gt;]&
xref:BloombergLP/bdlb/NullableValue/operator_assign-08f.adoc[operator&equals;](xref:BloombergLP/bslmf/MovableRef.adoc[bslmf::MovableRef&lt;NullableValue&gt;] rhs);
----

[.small]#xref:BloombergLP/bdlb/NullableValue/operator_assign-08f.adoc[_» more&period;&period;&period;_]#

Assign to this object the value of the specified `rhs`, and return a reference providing modifiable access to this object&period; The contents of `rhs` are either move&hyphen;inserted into or move&hyphen;assigned to this object&period; `rhs` is left in a valid but unspecified state&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:BloombergLP/bdlb/NullableValue.adoc[NullableValue&lt;TYPE&gt;]&
xref:BloombergLP/bdlb/NullableValue/operator_assign-0f.adoc[operator&equals;](xref:BloombergLP/bslmf/MovableRef.adoc[bslmf::MovableRef&lt;TYPE&gt;] rhs);
----

[.small]#xref:BloombergLP/bdlb/NullableValue/operator_assign-0f.adoc[_» more&period;&period;&period;_]#

Assign to this object the value of the specified `rhs` object, and return a non&hyphen;`const` reference to this object&period; The allocators of this object and `rhs` both remain unchanged&period; The contents of `rhs` are either move&hyphen;constructed into or move&hyphen;assigned to this object&period; `rhs` is left in a valid but unspecified state&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 to this object the value of the specified `rhs`, and return a reference providing modifiable access to this object&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:BloombergLP/bdlb/NullableValue.adoc[NullableValue&lt;TYPE&gt;]&
xref:BloombergLP/bdlb/NullableValue/operator_assign-05f.adoc[operator&equals;](TYPE const& rhs);
----

[.small]#xref:BloombergLP/bdlb/NullableValue/operator_assign-05f.adoc[_» more&period;&period;&period;_]#

Reset this object to the default constructed state (i&period;e&period;, to have the null value), and return a reference providing modifiable access to this object&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:BloombergLP/bdlb/NullableValue.adoc[NullableValue&lt;TYPE&gt;]&
xref:BloombergLP/bdlb/NullableValue/operator_assign-07.adoc[operator&equals;](xref:bsl/nullopt_t.adoc[bsl::nullopt&lowbar;t] const&) noexcept;
----

[.small]#xref:BloombergLP/bdlb/NullableValue/operator_assign-07.adoc[_» more&period;&period;&period;_]#

Assign to this object the null value if the specified `rhs` object is null, and the value of `rhs&period;value()` (of `BDE&lowbar;OTHER&lowbar;TYPE`) converted to `TYPE` otherwise&period; Return a reference providing modifiable access to this object&period; Note that this method will fail to compile if `TYPE` and &grave;BDE&lowbar;OTHER&lowbar;TYPE&apos; are not compatible&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class BDE&lowbar;OTHER&lowbar;TYPE&gt;
xref:BloombergLP/bdlb/NullableValue.adoc[NullableValue&lt;TYPE&gt;]&
xref:BloombergLP/bdlb/NullableValue/operator_assign-034.adoc[operator&equals;](xref:BloombergLP/bslmf/MovableRef_Deduced.adoc[BloombergLP::bslmf::MovableRef&lowbar;Deduced&lt;NullableValue&lt;BDE&lowbar;OTHER&lowbar;TYPE&gt;&gt;] rhs);
----

[.small]#xref:BloombergLP/bdlb/NullableValue/operator_assign-034.adoc[_» more&period;&period;&period;_]#

Disengage this object if the specified `rhs` object is disengaged, and move assign to this object the value of `rhs&period;value()` (of `t&lowbar;ANY&lowbar;TYPE`) converted to `t&lowbar;TYPE` otherwise&period; Return a reference providing modifiable access to this object&period; Note that this method does not participate in overload resolution unless `t&lowbar;TYPE` and `t&lowbar;ANY&lowbar;TYPE` are compatible&period; This assignment operator can be called in constant expressions only when neither `t&lowbar;TYPE` nor `t&lowbar;ANY&lowbar;TYPE` is allocator&hyphen;aware&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 to this object the null value if the specified `rhs` object is null, and the value of `rhs&period;value()` (of `BDE&lowbar;OTHER&lowbar;TYPE`) converted to `TYPE` otherwise&period; Return a reference providing modifiable access to this object&period; Note that this method will fail to compile if `TYPE` and &grave;BDE&lowbar;OTHER&lowbar;TYPE&apos; are not compatible&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class BDE&lowbar;OTHER&lowbar;TYPE&gt;
xref:BloombergLP/bdlb/NullableValue.adoc[NullableValue&lt;TYPE&gt;]&
xref:BloombergLP/bdlb/NullableValue/operator_assign-002.adoc[operator&equals;](xref:BloombergLP/bslmf/MovableRef_Deduced.adoc[BloombergLP::bslmf::MovableRef&lowbar;Deduced&lt;bsl::optional&lt;BDE&lowbar;OTHER&lowbar;TYPE&gt;&gt;] rhs)
requires bsl&colon;&colon;is&lowbar;convertible&lt;BDE&lowbar;OTHER&lowbar;TYPE, TYPE&gt;&colon;&colon;value;
----

[.small]#xref:BloombergLP/bdlb/NullableValue/operator_assign-002.adoc[_» more&period;&period;&period;_]#

Assign to this object the value of the specified `rhs` object (of `BDE&lowbar;OTHER&lowbar;TYPE`) converted to `TYPE`, and return a reference providing modifiable access to this object&period; Note that this method will fail to compile if `TYPE` and `BDE&lowbar;OTHER&lowbar;TYPE` are not compatible&period; Note that on C&plus;&plus;03 but not in C&plus;&plus;11 and beyond, if `BDE&lowbar;OTHER&lowbar;TYPE` is `bslmf&colon;&colon;MovableRef&lt;TYPE3&gt;` and `TYPE` supports moves and&sol;or assigns from that type, a move rather than a copy may take place&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class BDE&lowbar;OTHER&lowbar;TYPE&gt;
xref:BloombergLP/bdlb/NullableValue.adoc[NullableValue&lt;TYPE&gt;]&
xref:BloombergLP/bdlb/NullableValue/operator_assign-039.adoc[operator&equals;](BDE&lowbar;OTHER&lowbar;TYPE const& rhs);
----

[.small]#xref:BloombergLP/bdlb/NullableValue/operator_assign-039.adoc[_» more&period;&period;&period;_]#

Assign to this object the null value if the specified `rhs` object is null, and the value of `rhs&period;value()` (of `BDE&lowbar;OTHER&lowbar;TYPE`) converted to `TYPE` otherwise&period; Return a reference providing modifiable access to this object&period; Note that this method will fail to compile if `TYPE` and &grave;BDE&lowbar;OTHER&lowbar;TYPE&apos; are not compatible&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class BDE&lowbar;OTHER&lowbar;TYPE&gt;
xref:BloombergLP/bdlb/NullableValue.adoc[NullableValue&lt;TYPE&gt;]&
xref:BloombergLP/bdlb/NullableValue/operator_assign-054.adoc[operator&equals;](xref:bsl/optional-072.adoc[bsl::optional&lt;BDE&lowbar;OTHER&lowbar;TYPE&gt;] const& rhs)
requires bsl&colon;&colon;is&lowbar;convertible&lt;BDE&lowbar;OTHER&lowbar;TYPE, TYPE&gt;&colon;&colon;value;
----

[.small]#xref:BloombergLP/bdlb/NullableValue/operator_assign-054.adoc[_» more&period;&period;&period;_]#

Disengage this object if the specified `rhs` object is disengaged, and assign to this object the value of `rhs&period;value()` (of `t&lowbar;ANY&lowbar;TYPE`) converted to `t&lowbar;TYPE` otherwise&period; Return a reference providing modifiable access to this object&period; Note that this method does not participate in overload resolution unless `t&lowbar;TYPE` and `t&lowbar;ANY&lowbar;TYPE` are compatible&period; This assignment operator can be called in constant expressions only when `t&lowbar;TYPE` is not allocator&hyphen;aware&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 to this object the value of the specified `rhs` object converted to `t&lowbar;TYPE`, and return a reference providing modifiable access to this object&period; Note that this method may invoke assignment from `rhs`, or construction from `rhs`, depending on whether this object is engaged&period; This assignment operator does not participate in overload resolution if `t&lowbar;ANY&lowbar;TYPE` is possibly cv&hyphen;qualified `bsl&colon;&colon;optional&lt;t&lowbar;TYPE&gt;`&period; Also note that an assignment of the form `o &equals; &lcub;&rcub;&semi;`, where `o` is of type `optional`, will always assign to `o` the empty state, and never call this overload (see implementation notes)&period; This assignment operator can be called in constant expressions only when `t&lowbar;TYPE` is not allocator&hyphen;aware&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;_]#

Disengage this object if the specified `rhs` object is disengaged, and move assign to this object the value of `rhs&period;value()` (of `t&lowbar;ANY&lowbar;TYPE`) converted to `t&lowbar;TYPE` otherwise&period; Return a reference providing modifiable access to this object&period; Note that this method does not participate in overload resolution unless `t&lowbar;TYPE` and `t&lowbar;ANY&lowbar;TYPE` are compatible&period; This assignment operator can be called in constant expressions only when `t&lowbar;TYPE` is not allocator&hyphen;aware&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;_]#


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