template <class T> struct not_equal_to; |
C++98 |
template <class T> struct not_equal_to : binary_function <T,T,bool> { bool operator() (const T& x, const T& y) const {return x!=y;} }; |
成员类型 | 定义 | 注释 |
first_argument_type | T | 成员operator()中第一个参数的类型 |
second_argument_type | T | 成员operator()中第二个参数的类型 |
result_type | bool | 成员operator()返回的类型 |
T operator() (const T& x, const T& y) |
// not_equal_to example #include <iostream> // std::cout #include <functional> // std::not_equal_to #include <algorithm> // std::adjacent_find int main () { int numbers[]={10,10,10,20,20}; int* pt = std::adjacent_find (numbers, numbers+5, std::not_equal_to<int>()) +1; std::cout << "The first different element is " << *pt << '\n'; return 0; } |
equal_to | 用于相等比较的函数对象类(类模板) |
greater | 用于大于不等式比较的函数对象类(类模板) |
less | 用于小于不等比较的函数对象类(类模板) |
greater_equal | 用于大于等于比较的函数对象类(类模板) |
less_equal | 用于小于等于比较的函数对象类(类模板) |
binary_function | 二元函数对象基类 (类模板) |