Skip to content

Latest commit

 

History

History
64 lines (49 loc) · 1.24 KB

op_not_equal.md

File metadata and controls

64 lines (49 loc) · 1.24 KB

operator!=

  • filesystem[meta header]
  • std::filesystem[meta namespace]
  • function[meta id-type]
  • cpp17[meta cpp]
namespace std::filesystem {
  // operator==により、以下のオーバーロードが使用可能になる (C++20)
  bool operator!=(const path& lhs, const path& rhs) noexcept; // (1) C++17
}

概要

非等値比較を行う

戻り値

return !(lhs == rhs);

#include <cassert>
#include <filesystem>

namespace fs = std::filesystem;

int main()
{
  fs::path a = "a/b/c";
  fs::path b = "a/b/d";

  assert(a != b);
  assert(!(a != a));

  // 正規化は考慮されない。
  // ファイルシステムとしてのパスの等価性ではなく、
  // パス文字列の同値性が比較されれる
  fs::path c = "a/../b/c";
  assert(a != c);
}
  • !=[color ff0000]

出力

バージョン

言語

  • C++17

処理系

参照