• Class / Function / Type

      std::
    • Header file

      <>
    • Other / All

    最終更新日時(UTC):
    が更新

    履歴 編集

    function
    <filesystem>

    std::filesystem::directory_entry::operator==

    bool operator==(const directory_entry& rhs) const noexcept; // (1) C++17
    

    概要

    directory_entryオブジェクトを等値比較する。

    戻り値

    return path() == rhs.path();
    

    例外

    投げない

    備考

    • この演算子により、以下の演算子が使用可能になる:
      • operator!=

    #include <iostream>
    #include <filesystem>
    
    namespace fs = std::filesystem;
    
    int main()
    {
      fs::directory_entry x{"a.txt"};
      fs::directory_entry y{"a.txt"};
    
      if (x == y) {
        std::cout << "equal" << std::endl;
      }
    }
    

    出力

    equal
    

    バージョン

    言語

    • C++17

    処理系

    参照