Constructs the inner value T by direct‐initialization from u.

Synopsis

Declared in <absl/status/statusor.h>

template<typename U = T>
requires internal_statusor::IsConstructionValid<
                                 false, T, U, false>::value
StatusOr(U&& u);

Description

Constructs the inner value T in‐place using the provided args, using the T(U) (direct‐initialization) constructor. This constructor is only valid if T can be constructed from a U. Can accept move or copy constructors.

This constructor is explicit if U is not convertible to T. To avoid ambiguity, this constructor is disabled if U is a StatusOr<J>, where J is convertible to T.

Parameters

Name

Description

u

The value used to direct‐initialize the held object.

Created with MrDocs