Perfect-forwarding value assignment operator.
Declared in <absl/status/statusor.h>
template<typename U = T>
requires internal_statusor::IsAssignmentValid<T, U, false>::value
StatusOr&
operator=(U&& v);
If *this contains a T value before the call, the contained value is assigned from std::forward<U>(v); Otherwise, it is directly-initialized from std::forward<U>(v). This function does not participate in overload unless: 1. std::is_constructible_v<T, U> is true, 2. std::is_assignable_v<T&, U> is true. 3. std::is_same_v<StatusOr<T>, std::remove_cvref_t<U>> is false. 4. Assigning U to T is not ambiguous: If U is StatusOr<V> and T is constructible and assignable from both StatusOr<V> and V, the assignment is considered bug-prone and ambiguous thus will fail to compile. For example: StatusOr<bool> s1 = true; // s1.ok() && *s1 == true StatusOr<bool> s2 = false; // s2.ok() && *s2 == false s1 = s2; // ambiguous, s1 = *s2 or s1 = bool(s2)?
A reference to *this.
| Name | Description |
|---|---|
| v | The value to assign into the held object. |