[#absl-StatusOr-2constructor-00d] = xref:absl.adoc[absl]::xref:absl/StatusOr.adoc[StatusOr]::StatusOr :relfileprefix: ../../ :mrdocs: Constructs a new `StatusOr<T>` from a value convertible to `Status`. == Synopsis Declared in `<absl/status/statusor.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<typename U = xref:absl/Status.adoc[absl::Status]> requires internal_statusor::IsConstructionFromStatusValid< false, T, U>::value StatusOr(U&& v); ---- == Description Constructs a new `absl::StatusOr<T>` with a non‐ok status. After calling this constructor, `this‐>ok()` will be `false` and calls to `value()` will crash, or produce an exception if exceptions are enabled. The constructor also takes any type `U` that is convertible to `absl::Status`. This constructor is explicit if an only if `U` is not of type `absl::Status` and the conversion from `U` to `Status` is explicit. REQUIRES: !Status(std::forward<U>(v)).ok(). This requirement is DCHECKed. In optimized builds, passing absl::OkStatus() here will have the effect of passing absl::StatusCode::kInternal as a fallback. == Parameters [cols="1,4"] |=== | Name| Description | *v* | The status (or value convertible to a status) to store. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#