Function Subspace :: sus :: ops :: try_from_output

template <class T>
auto try_from_output(sus::ops::TryImpl<T>::Output&& t) -> T
requires
sus::ops::Try<T>
!std::is_const_v<T>
!std::is_reference_v<T>
!std::is_void_v<typename TryImpl<T>::Output>

Constructs an object of type T that satisfies Try from a value that represents success for T.

For instance, this constructs a Result<T, E> from a T since Result satisfies Try and T is the type that represents its success values.

The template variable T must be specified as it can not be deduced here. For example: sus::ops::try_from_output<Result<T, E>>(T()).

Void success values

The Output type of Try<T> can not be void. To construct a type that has an output of void, require T to be TryDefault and use try_from_default.