operator==,!=,<,<=,>,>=(std::experimental::filesystem::path)
来自 cppreference.cn
< 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。
[编辑] 参阅
按字典顺序比较两个路径的词法表示 (公共成员函数) |