Skip to content

Latest commit

 

History

History
62 lines (47 loc) · 1.16 KB

File metadata and controls

62 lines (47 loc) · 1.16 KB

operator<

  • 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++17

概要

directory_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

処理系

参照