- filesystem[meta header]
- std::filesystem[meta namespace]
- function[meta id-type]
- cpp17[meta cpp]
namespace std::filesystem {
bool operator==(const path& lhs, const path& rhs) noexcept;
}等値比較を行う
return !(lhs < rhs) && !(rhs < lhs);lhs.compare(rhs) == 0と等価
#include <cassert>
#include <filesystem>
namespace fs = std::filesystem;
int main()
{
fs::path a = "a/b/c";
fs::path b = "a/b/d";
assert(a == a);
assert(!(a == b));
// 正規化は考慮されない。
// ファイルシステムとしてのパスの等価性ではなく、
// パス文字列の同値性が比較されれる
fs::path c = "a/../b/c";
assert(!(a == c));
}- ==[color ff0000]
- C++17
- Clang:
- GCC, C++17 mode: 8.1
- Visual C++: