• Class / Function / Type

      std::
    • Header file

      <>
    • Other / All

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

    履歴 編集

    function
    <filesystem>

    std::filesystem::file_status::type

    void type(file_type ft) noexcept; // (1)
    file_type type() const noexcept;  // (2)
    

    概要

    ファイル種別を設定・取得する。

    効果

    • (1) : ファイル種別ft*thisに設定する
    • (2) : 設定されているファイル種別を戻り値として返す

    例外

    • (1), (2) : 投げない

    #include <cassert>
    #include <filesystem>
    
    namespace fs = std::filesystem;
    
    int main()
    {
      fs::file_status status;
    
      status.type(fs::file_type::regular);
      assert(status.type() == fs::file_type::regular);
    }
    

    出力

    バージョン

    言語

    • C++17

    処理系