Concept Subspace :: sus :: ops :: TryDefault
template <class T>concept TryDefault
requires
sus::ops::Try<T>
requires {
// from_default() construct the Try type with the default value for its
// success type.
{ TryImpl<std::remove_const_t<T>>::from_default() } -> std::same_as<T>;
}
Identifies Try
types which can be constructed with a
default success value.
This takes the place of the unit (void) type in Rust types, such as
Option<()>
and Result<(), E>
since void
is not a constructible type
in C++. But by satisfying TryDefault
,
Result<void, E>
can be constructed with a default
success value of nothing.