[#absl-StatusOr-operator_assign-08]
= xref:absl.adoc[absl]::xref:absl/StatusOr.adoc[StatusOr]::operator&equals;
:relfileprefix: ../../
:mrdocs:

Converting assignment operator from an `absl&colon;&colon;StatusOr&lt;U&gt;`&period;

== Synopsis

Declared in `&lt;absl&sol;status&sol;statusor&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;typename U&gt;
requires internal&lowbar;statusor&colon;&colon;IsStatusOrAssignmentValid&lt;
                                  T, const U&amp;, false&gt;&colon;&colon;value
xref:absl/StatusOr.adoc[StatusOr]&
operator&equals;(xref:absl/StatusOr.adoc[StatusOr&lt;U&gt;] const& other);
----

== Description

Creates an `absl&colon;&colon;StatusOr&lt;T&gt;` through assignment from an `absl&colon;&colon;StatusOr&lt;U&gt;` when&colon;

&ast; Both `absl&colon;&colon;StatusOr&lt;T&gt;` and `absl&colon;&colon;StatusOr&lt;U&gt;` are OK by assigning `U` to `T` directly&period; &ast; `absl&colon;&colon;StatusOr&lt;T&gt;` is OK and `absl&colon;&colon;StatusOr&lt;U&gt;` contains an error code by destroying `absl&colon;&colon;StatusOr&lt;T&gt;`&apos;s value and assigning from &grave;absl&colon;&colon;StatusOr&lt;U&gt;&apos; &ast; `absl&colon;&colon;StatusOr&lt;T&gt;` contains an error code and `absl&colon;&colon;StatusOr&lt;U&gt;` is OK by directly initializing `T` from `U`&period; &ast; Both `absl&colon;&colon;StatusOr&lt;T&gt;` and `absl&colon;&colon;StatusOr&lt;U&gt;` contain an error code by assigning the `Status` in `absl&colon;&colon;StatusOr&lt;U&gt;` to `absl&colon;&colon;StatusOr&lt;T&gt;`

These overloads only apply if `absl&colon;&colon;StatusOr&lt;T&gt;` is constructible and assignable from `absl&colon;&colon;StatusOr&lt;U&gt;` and `StatusOr&lt;T&gt;` cannot be directly assigned from `StatusOr&lt;U&gt;`&period;

== Return Value

A reference to `&ast;this`&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *other*
| The source `StatusOr&lt;U&gt;` to assign from&period;
|===


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