- filesystem[meta header]
- std::filesystem[meta namespace]
- directory_entry[meta class]
- function[meta id-type]
- cpp17[meta cpp]
// operator<=>により、以下のオーバーロードが使用可能になる (C++20)
bool operator<(const directory_entry& rhs) const noexcept; // (1) C++17directory_entryオブジェクトにおいて、左辺が右辺より小さいかの判定を行う。
return path() < rhs.path();- path()[link path.md]
投げない
#include <iostream>
#include <filesystem>
namespace fs = std::filesystem;
int main()
{
fs::directory_entry x{"a.txt"};
fs::directory_entry y{"b.txt"};
if (x < y) {
std::cout << "less" << std::endl;
}
}less
- C++17
- Clang:
- GCC: 8.1
- Visual C++:
- P1614R2 The Mothership has Landed
- C++20での三方比較演算子の追加と、関連する演算子の自動導出