求C++中比较两个数的大小的库函数

来源:百度知道 编辑:UC知道 时间:2024/05/14 06:46:48
急着要用

直接自己写个呗

bool greater(int lhs, int rhs)
{
return lhs > rhs;
}

或者你实在要用std::greater也可以这样:

bool test = greater<int>()(1, 2);

template<class T>
struct greater : public binary_function<T, T, bool> {
bool operator()(const T& x, const T& y) const;
};