命名空间
变体
操作

std::experimental::ranges::not_equal_to

来自 cppreference.cn
< cpp‎ | experimental‎ | ranges
 
 
实验性
技术规范
文件系统库 (filesystem TS)
库基础 (library fundamentals TS)
库基础 2 (library fundamentals TS v2)
库基础 3 (library fundamentals TS v3)
并行扩展 (parallelism TS)
并行扩展 2 (parallelism TS v2)
并发扩展 (concurrency TS)
并发扩展 2 (concurrency TS v2)
概念 (concepts TS)
范围 (ranges TS)
反射 (reflection TS)
数学特殊函数 (special functions TR)
实验性非 TS
模式匹配
线性代数
std::execution
契約
2D 图形
 
 
通用工具库
实用工具组件
函数对象
not_equal_to
元编程和类型特征
标记对和元组
                          
标签指定符
                                      
                          
 
template< class T = void >

    requires EqualityComparable<T> ||
             Same<T, void> ||
             /* == on two const T lvalues invokes a built-in operator comparing pointers */

struct not_equal_to;
(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> 特化的成员) /* unspecified */

[编辑] 成员函数

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> ||
             /* std::declval() == std::declval() resolves to
                a built-in operator comparing pointers */

constexpr bool operator()(T&& t, U&& u) const;
(2) (仅 not_equal_to<void> 特化的成员)
1) 比较 xy。等价于 return !ranges::equal_to<>{}(x, y);
2) 比较 tu。等价于 return !ranges::equal_to<>{}(std::forward<T>(t), std::forward<U>(u));

[编辑] 注释

std::not_equal_to 不同,ranges::not_equal_to 要求 ==!= 都是有效的 (通过 EqualityComparableEqualityComparableWith 约束),并且完全根据 ranges::equal_to 定义。但是,实现可以自由地直接使用 operator!=,因为这些概念要求 ==!= 的结果是一致的。

[编辑] 示例

[编辑] 参见

实现 x != y 的函数对象
(类模板) [编辑]