Je suis en train de trier une liste (partie d'une classe) dans l'ordre décroissant contenant des éléments d'un struct
, mais il ne compile pas:liste Trier en utilisant la fonction de tri STL
error: no match for 'operator-' in '__last - __first'
sort(Result.poly.begin(), Result.poly.end(), SortDescending());
Et voici SortDescending
:
struct SortDescending
{
bool operator()(const term& t1, const term& t2)
{
return t2.pow < t1.pow;
}
};
quelqu'un peut-il me dire ce qui ne va pas?
@Glen voir http://stackoverflow.com/questions/2425452/polynomial-operations-using-operator-overloading – Vlad