- 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
- Clang:
- GCC: 8.1
- Visual C++: 2017 Update 7
- P1614R2 The Mothership has Landed
- C++20での三方比較演算子の追加と、関連する演算子の自動導出