operator==,!=,<,<=,>,>=(std::experimental::filesystem::path)
来自 cppreference.cn
< cpp | experimental | fs | path
bool operator==( const path& lhs, const path& rhs ); |
(1) | (filesystem TS) |
bool operator!=( const path& lhs, const path& rhs ); |
(2) | (filesystem TS) |
bool operator<( const path& lhs, const path& rhs ); |
(3) | (filesystem TS) |
bool operator<=( const path& lhs, const path& rhs ); |
(4) | (filesystem TS) |
bool operator>( const path& lhs, const path& rhs ); |
(5) | (filesystem TS) |
bool operator>=( const path& lhs, const path& rhs ); |
(6) | (filesystem 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 规范:
noexcept
[编辑] 注释
路径相等性和等价性具有不同的语义。
在相等的情况下,由 operator==
确定,仅比较词法表示。因此,path("a") == path("b") 永远不会为 true。
在等价的情况下,由 equivalent() 确定,会检查两个路径是否解析为相同的文件系统对象。因此,如果路径解析为相同的文件,equivalent("a", "b") 将返回 true。
[编辑] 另请参阅
字典序比较两个路径的词法表示 (公共成员函数) |