1、greater、 less
greater和less都重载了操作符
// TEMPLATE STRUCT greater template<class _Ty> struct greater : public binary_function<_Ty, _Ty, bool> { // functor for operator> bool operator()(const _Ty& _Left, const _Ty& _Right) const { // apply operator> to operands return (_Left > _Right); } }; // TEMPLATE STRUCT less template<class _Ty> struct less : public binary_function<_Ty, _Ty, bool> { // functor for operator< bool operator()(const _Ty& _Left, const _Ty& _Right) const { // apply operator< to operands return (_Left < _Right); } };
2、Demo测试
发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/232253.html原文链接:https://javaforall.net
