operator==,!=,<,<=,>,>=(std::experimental::filesystem::path)
來自 cppreference.com
< cpp | experimental | fs | path
bool operator==( const path& lhs, const path& rhs ); |
(1) | (檔案系統 TS) |
bool operator!=( const path& lhs, const path& rhs ); |
(2) | (檔案系統 TS) |
bool operator<( const path& lhs, const path& rhs ); |
(3) | (檔案系統 TS) |
bool operator<=( const path& lhs, const path& rhs ); |
(4) | (檔案系統 TS) |
bool operator>( const path& lhs, const path& rhs ); |
(5) | (檔案系統 TS) |
bool operator>=( const path& lhs, const path& rhs ); |
(6) | (檔案系統 TS) |
按字典序比較兩個路徑。
1) 檢查 lhs 和 rhs 是否相等。等價於 !(lhs < rhs) && !(rhs < lhs)。
2) 檢查 lhs 和 rhs 是否不相等。等價於 !(lhs == rhs)。
3) 檢查 lhs 是否小於 rhs。等價於 lhs.compare(rhs) < 0。
4) 檢查 lhs 是否小於或等於 rhs。等價於 !(rhs < lhs)。
5) 檢查 lhs 是否大於 rhs。等價於 rhs < lhs。
6) 檢查 lhs 是否大於或等於 rhs。等價於 !(lhs < rhs)。
目錄 |
[編輯] 引數
lhs, rhs | - | 要比較的路徑 |
[編輯] 返回值
如果對應的比較成立,則為 true,否則為 false。
[編輯] 異常
noexcept 規範:
不拋異常
[編輯] 注意
路徑相等和等價具有不同的語義。
在相等的情況下(由 operator==
確定),只比較詞法表示。因此,path("a") == path("b") 永遠不是 true。
在等價的情況下(由 equivalent() 確定),它會檢查兩個路徑是否解析為相同的檔案系統物件。因此,如果路徑解析為相同的檔案,equivalent("a", "b") 將返回 true。
[編輯] 參閱
按字典順序比較兩個路徑的詞法表示 (公共成員函式) |