[expected.void.eq]

# 22 General utilities library [[utilities]](./#utilities)

## 22.8 Expected objects [[expected]](expected#void.eq)

### 22.8.7 Partial specialization of expected for void types [[expected.void]](expected.void#eq)

#### 22.8.7.8 Equality operators [expected.void.eq]

[ð](#lib:operator==,expected%3cvoid%3e)

`template<class T2, class E2> requires is_void_v<T2>
  friend constexpr bool operator==(const expected& x, const expected<T2, E2>& y);
`

[1](#1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L10327)

*Constraints*: The expression x.error() == y.error() is well-formed and
its result is convertible to bool[.](#1.sentence-1)

[2](#2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L10332)

*Returns*: If x.has_value() does not equal y.has_value(), false;
otherwise x.has_value() || static_cast<bool>(x.error() == y.error())[.](#2.sentence-1)

[ð](#lib:operator==,expected%3cvoid%3e_)

`template<class E2>
  friend constexpr bool operator==(const expected& x, const unexpected<E2>& e);
`

[3](#3)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L10345)

*Constraints*: The expression x.error() == e.error() is well-formed and
its result is convertible to bool[.](#3.sentence-1)

[4](#4)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L10350)

*Returns*: !x.has_value() && static_cast<bool>(x.error() == e.error())[.](#4.sentence-1)
