• Class / Function / Type

      std::
    • Header file

      <>
    • Other / All

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

    履歴 編集

    function
    <filesystem>

    std::filesystem::path::clear

    void clear() noexcept;
    

    概要

    パスを空にする。

    事後条件

    empty() == true
    

    #include <iostream>
    #include <filesystem>
    
    namespace fs = std::filesystem;
    
    int main()
    {
      fs::path p = "/usr/bin/clang";
    
      p.clear();
      if (p.empty()) {
        std::cout << "cleared" << std::endl;
      }
    }
    

    出力

    cleared
    

    バージョン

    言語

    • C++17

    処理系