Important
<experimental/filesystem>標頭與std::experimental::filesystem命名空間提供了檔案系統技術規範(TS)的預先實作。 此文件保留用於針對 MSVC 原始檔案系統實作撰寫的程式碼,該實作自 MSVC 版本 14.51 起被移除。 新程式碼則改用 C++17 <filesystem> 標頭和 std::filesystem 命名空間。 關於這些運算子的標準等價物,請參見 <filesystem> 運算子。
這些 std::experimental::filesystem::path 非成員運算子會在歷史 <experimental/filesystem> 標頭中宣告。 比較運算子以通用格式逐元素比較兩條路徑,使用 path::compare,而非原始字串。 使用這個 equivalent 函式來判斷兩個路徑(例如相對路徑與絕對路徑)是否指涉磁碟上的相同檔案或目錄。
欲了解更多資訊,請參閱檔案系統導航(C++)。
Requirements
標頭:<experimental/filesystem>
命名空間:std::experimental::filesystem
operator==
bool operator==(const path& left, const path& right) noexcept;
函數返回 left.compare(right) == 0。
operator!=
bool operator!=(const path& left, const path& right) noexcept;
函數返回 !(left == right)。
運算元<
bool operator<(const path& left, const path& right) noexcept;
函數返回 left.compare(right) < 0。
運算子<=
bool operator<=(const path& left, const path& right) noexcept;
函數返回 !(right < left)。
運算元>
bool operator>(const path& left, const path& right) noexcept;
函數返回 right < left。
運算子>=
bool operator>=(const path& left, const path& right) noexcept;
函數返回 !(left < right)。
operator/
path operator/(const path& left, const path& right);
函數返回 path(left) /= right。
運算元<<
template <class Elem, class Traits>
basic_ostream<Elem, Traits>& operator<<(basic_ostream<Elem, Traits>& os, const path& pval);
該函數將路徑的字串表示插入串流中。 它會傳回 os << pval.string<Elem, Traits>()。
運算元>>
template <class Elem, class Traits>
basic_istream<Elem, Traits>& operator>>(basic_istream<Elem, Traits>& is, path& pval);
該函數從串流中擷取一個字串並指派給 pval。 其執行方式如下:
basic_string<Elem, Traits> str;
is >> str;
pval = str;
return is;
參見
<experimental/filesystem>
<experimental/filesystem> 函數
<experimental/filesystem> 列舉