not_equal_to
描述 (Description)
它是用于非相等比较的函数对象类和二进制函数对象类,其调用返回它的两个参数是否相等(由运算符运算符返回!=)。
声明 (Declaration)
以下是std :: not_equal_to的声明。
template <class T> struct not_equal_to;
C++11
template <class T> struct not_equal_to;
参数 (Parameters)
T - 它是函数调用的参数和返回类型的一种类型。
返回值 (Return Value)
没有
异常 (Exceptions)
noexcep - 它不会抛出任何异常。
例子 (Example)
在下面的例子中解释了std :: not_equal_to。
#include <iostream>
#include <functional>
#include <algorithm>
int main () {
int numbers[]={10,20,30,40,50};
int* pt = std::adjacent_find (numbers, numbers+5, std::not_equal_to<int>()) +1;
std::cout << " Different element is " << *pt << '\n';
return 0;
}
让我们编译并运行上面的程序,这将产生以下结果 -
Different element is 20