Tôi đang cố gắng sắp xếp một danh sách (một phần của một lớp) để chứa các đối tượng có struct
giảm dần, nhưng nó không biên dịch:Sắp xếp danh sách sử dụng STL loại chức năng
error: no match for 'operator-' in '__last - __first'
sort(Result.poly.begin(), Result.poly.end(), SortDescending());
Và đây là SortDescending
:
struct SortDescending
{
bool operator()(const term& t1, const term& t2)
{
return t2.pow < t1.pow;
}
};
Bất cứ ai có thể cho tôi biết có vấn đề gì không?
@Glen xem http://stackoverflow.com/questions/2425452/polynomial-operations-using-operator-overloading – Vlad