17 Language support library [language.support]

17.11 Comparisons [cmp]

17.11.2 Comparison category types [cmp.categories]

17.11.2.2 Class weak_­equality [cmp.weakeq]

The weak_­equality type is typically used as the result type of a three-way comparison operator that (a) admits only equality and inequality comparisons, and (b) does not imply substitutability.
namespace std {
  class weak_equality {
    int value;  // exposition only

    // exposition-only constructor
    constexpr explicit weak_equality(eq v) noexcept : value(int(v)) {}  // exposition only

  public:
    // valid values
    static const weak_equality equivalent;
    static const weak_equality nonequivalent;

    // comparisons
    friend constexpr bool operator==(weak_equality v, unspecified) noexcept;
    friend constexpr bool operator==(weak_equality v, weak_equality w) noexcept = default;
    friend constexpr weak_equality operator<=>(weak_equality v, unspecified) noexcept;
    friend constexpr weak_equality operator<=>(unspecified, weak_equality v) noexcept;
  };

  // valid values' definitions
  inline constexpr weak_equality weak_equality::equivalent(eq::equivalent);
  inline constexpr weak_equality weak_equality::nonequivalent(eq::nonequivalent);
}
constexpr bool operator==(weak_equality v, unspecified) noexcept;
Returns: v.value == 0.
constexpr weak_equality operator<=>(weak_equality v, unspecified) noexcept; constexpr weak_equality operator<=>(unspecified, weak_equality v) noexcept;
Returns: v.