Skip to content

Latest commit

 

History

History
60 lines (45 loc) · 1.21 KB

File metadata and controls

60 lines (45 loc) · 1.21 KB

operator!=

  • expected[meta header]
  • function template[meta id-type]
  • std[meta namespace]
  • unexpected[meta class]
  • cpp23[meta cpp]
// operator==により、下記オーバーロードが使用可能になる
template<class E2>
friend constexpr bool operator!=(const unexpected& x, const unexpected<E2>& y);
  • operator==[link op_equal.md]
  • unexpected[link ../unexpected.md]

概要

unexpectedオブジェクト同士の非等値比較を行う。

適格要件

x.error() == y.error()が適格であり、その結果をboolへ変換可能であること。

戻り値

!(x == y)

#include <cassert>
#include <expected>

int main()
{
  std::unexpected<long>  x{1};
  std::unexpected<short> y{2};
  assert(x != y);
}
  • !=[color ff0000]
  • std::unexpected[link ../unexpected.md]

出力

バージョン

言語

  • C++23

処理系

参照