【发布时间】:2015-10-16 18:11:18
【问题描述】:
如何使用std::rel_ops 专门化std::greater?
我有这样的东西
#include <utility>
#include <functional>
using namespace std::rel_ops;
struct MyStruct {
int field;
bool operator < (const MyStruct& rhs) const {
return field < rhs.field;
}
};
所以我需要按降序对元素进行排序。我如何使用operator <、std::rel_ops 和std::greater 来做到这一点?
【问题讨论】: