operator==,!=,<,<=,>,>=(std::filesystem::path)

bool operator==( const path& lhs, const path& rhs ) noexcept;
(1) (C++17 起)
bool operator!=( const path& lhs, const path& rhs ) noexcept;
(2) (C++17 起)
bool operator<( const path& lhs, const path& rhs ) noexcept;
(3) (C++17 起)
bool operator<=( const path& lhs, const path& rhs ) noexcept;
(4) (C++17 起)
bool operator>( const path& lhs, const path& rhs ) noexcept;
(5) (C++17 起)
bool operator>=( const path& lhs, const path& rhs ) noexcept;
(6) (C++17 起)

以字典序比较二个 path 。

1) 检查 lhsrhs 是否相等。等价于 !(lhs < rhs) && !(rhs < lhs)
2) 检查 lhsrhs 是否不相等,等价于 !(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

注意

路径相等与等价有不同语义。

相等情况下,以 operator== 确定,只比较字典表示。从而 path("a") == path("b") 决不可能为 true

等价情况下,以 equivalent() 确定,检查二个路径是否解析到同一文件系统对象。从而若路径解析到同一文件,则 equivalent("a", "b") 将返回 true

参阅

以字典序比较二个路径的字典表示
(公开成员函数)

版本历史

  • (当前 | 先前 2017年9月29日 (五) 09:26Fruderica讨论 | 贡献. . (1,991字节) (0). . (撤销)
  • 当前 | 先前) 2017年5月1日 (一) 05:23Fruderica讨论 | 贡献. . (1,991字节) (+1,991). . (以“{{title|1=operator==,!=,<,<=,>,>={{small|(std::filesystem::path)}}}} {{cpp/filesystem/path/navbar}} {{dcl begin}} {{dcl | num=1 | since=c++17 | 1= bool operator==( c...”为内容创建页面)