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 and rhs for equality.

  1. If lhs.has_value() != rhs.has_value(), then false is returned.

  2. If lhs.has_value() && rhs.has_value(), then their .value()s are compared; if both are void, the comparison is always equal.

  3. If !lhs.has_value() && !rhs.has_value(), then their .error()s are compared; if they are both void, the comparison is always equal.

Comparability of Template Parameters

When provided with lhs and rhs, their expected::value_type and expected::error_type parameters must either be equality comparable or void. If this is not the case, an error will occur in the immediate context (testing for equality comparison of expected types is not SFINAE-safe). It is not legal to compare a non-void type to a void type.