omni::operator==
Defined in omni/Expected.h
-
template<typename TValueLhs, typename TErrorLhs, typename TValueRhs, typename TErrorRhs>
constexpr bool omni::operator==(expected<TValueLhs, TErrorLhs> const &lhs, expected<TValueRhs, TErrorRhs> const &rhs) Compare the contents of
lhs
andrhs
for equality.If
lhs.has_value() != rhs.has_value()
, thenfalse
is returned.If
lhs.has_value() && rhs.has_value()
, then their.value()
s are compared; if both arevoid
, the comparison is always equal.If
!lhs.has_value() && !rhs.has_value()
, then their.error()
s are compared; if they are bothvoid
, the comparison is always equal.
- Comparability of Template Parameters
When provided with
lhs
andrhs
, their expected::value_type and expected::error_type parameters must either be equality comparable orvoid
. If this is not the case, an error will occur in the immediate context (testing for equality comparison ofexpected
types is not SFINAE-safe). It is not legal to compare a non-void
type to avoid
type.