Improve lambda call
This commit is contained in:
parent
b21b1416ab
commit
d18fc5606f
|
@ -447,13 +447,7 @@ void SFallArrayAssoc::MapSort(int type)
|
||||||
|
|
||||||
if (sortByValue) {
|
if (sortByValue) {
|
||||||
ListSort(keys, type, [this](const ArrayElement& a, const ArrayElement& b) -> bool {
|
ListSort(keys, type, [this](const ArrayElement& a, const ArrayElement& b) -> bool {
|
||||||
// Why return this->map[a] < this->map[b] does not work? Why it requires copy constructor?
|
return map.at(a) < map.at(b);
|
||||||
auto itA = this->map.find(a);
|
|
||||||
auto itB = this->map.find(a);
|
|
||||||
if (itA == map.end() || itB == map.end()) {
|
|
||||||
throw(std::exception());
|
|
||||||
};
|
|
||||||
return itA->second < itB->second;
|
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
ListSort(keys, type, std::less<ArrayElement>());
|
ListSort(keys, type, std::less<ArrayElement>());
|
||||||
|
|
Loading…
Reference in New Issue