STL内建的“关系运算符仿函数”支持了等于,不等于,大于,大于等于,小于,小于等于六中运算。每一种都是二元运算
template<class T> struct equal_to:public binary_function<T,T,bool> { bool operator()(const T&x,const T& y)const {return x==y;}; } template<class T> struct not_equal_to:public binary_function<T,T,bool> { bool operator()(const T& x,const T& y)const {return x!=y;} }; template<class T> struct greater:public binary_function<T,T,bool> { bool operator()(const T&x ,const T7 y)const {return x>y;} }; template<class T> struct less:public binary_function<T,T,bool> { bool operator()(const T&x ,const T7 y)const {return x<y;} }; template<class T> struct greater_equal:public binary_function<T,T,bool> { bool operator()(const T&x ,const T7 y)const {return x>=y;} }; template<class T> struct less_equal:public binary_function<T,T,bool> { bool operator()(const T&x ,const T7 y)const {return x<=y;} };