|
|
|
|
Erreur C2664 'bool std::greater<int>::operator ()(const _Ty &,const _Ty &) const' : impossible de convertir l'argument 1 de 'Billboard' en 'const _Ty &' |
Binary function that accepts two elements in the range as arguments, and returns a value convertible to bool. |
|
|
|
|
return sqrt((diffY * diffY) + (diffX * diffX));
|
|
|
|
|
|
|
|
Each object has its structure. So I can add a distance integer as a parameter. |
|
|
(1 2) (4 5) (2 4) (3 6) |
|
|
|
|
std::sort(billboards.begin(),billboards.end(), [](Billboard& a, Billboard& b) { return a.dist > b.dist; });
The signature of the comparison function should be equivalent to the following: bool cmp(const Type1 &a, const Type2 &b); While the signature does not need to have const &, the function must not modify the objects passed to it and must be able to accept all values of type (possibly const) Type1 and Type2 regardless of value category (thus, Type1 & is not allowed, nor is Type1 unless for Type1 a move is equivalent to a copy. https://en.cppreference.com/w/cpp/algorithm/sort |
|
|