std::experimental::ranges::not_equal_to
来自 cppreference.cn
< cpp | experimental | ranges
| template< class T = void > requires EqualityComparable<T> || |
(ranges TS) | |
| template<> struct not_equal_to<void>; |
(ranges TS) | |
用于执行比较的函数对象。主模板在类型为 T 的 const 左值上调用 operator == 并取反结果。特化 not_equal_to<void> 从参数推导函数调用运算符的参数类型(但不是返回类型)。
not_equal_to 的所有特化都是 Semiregular。
目录 |
[编辑] 成员类型
| 成员类型 | 定义 |
is_transparent (仅在 not_equal_to<void> 特化中是成员) |
/* 未指定 */ |
[编辑] 成员函数
| operator() |
检查参数是否“不相等” (公开成员函数) |
std::experimental::ranges::not_equal_to::operator()
| constexpr bool operator()(const T& x, const T& y) const; |
(1) | (仅在主 not_equal_to<T> 模板中是成员) |
| template< class T, class U > requires EqualityComparableWith<T, U> || |
(2) | (仅在 not_equal_to<void> 特化中是成员) |
[编辑] 注解
与 std::not_equal_to 不同,ranges::not_equal_to 要求 == 和 != 都是有效的(通过 EqualityComparable 和 EqualityComparableWith 约束),并且完全是根据 ranges::equal_to 定义的。然而,实现可以自由地直接使用 operator!=,因为这些概念要求 == 和 != 的结果保持一致。
[编辑] 示例
| 本节不完整 原因:无示例 |
[编辑] 参阅
| 实现 x != y 的函数对象 (类模板) |