命名空间
变体
操作

std::is_eq, std::is_neq, std::is_lt, std::is_gt, std::is_lteq, std::is_gteq

来自 cppreference.cn
< cpp‎ | utility
 
 
 
定义于头文件 <compare>
constexpr bool is_eq( std::partial_ordering cmp ) noexcept;
(1) (自 C++20 起)
constexpr bool is_neq( std::partial_ordering cmp ) noexcept;
(2) (自 C++20 起)
constexpr bool is_lt( std::partial_ordering cmp ) noexcept;
(3) (自 C++20 起)
constexpr bool is_lteq( std::partial_ordering cmp ) noexcept;
(4) (自 C++20 起)
constexpr bool is_gt( std::partial_ordering cmp ) noexcept;
(5) (自 C++20 起)
constexpr bool is_gteq( std::partial_ordering cmp ) noexcept;
(6) (自 C++20 起)

这些函数接受三路比较的结果,并将其转换为六个关系运算符之一的结果

具体而言,这些函数返回

1) cmp == 0
2) cmp != 0
3) cmp < 0
4) cmp <= 0
5) cmp > 0
6) cmp >= 0

目录

[编辑] 参数

cmp - 三路比较的结果

[编辑] 返回值

bool 相应关系运算的结果

[编辑] 示例

[编辑] 参见

支持所有 6 个运算符、不可替换且允许不可比较值的三路比较的结果类型
(类) [编辑]