Moving into ArrayElement
This commit is contained in:
parent
9441d5f4af
commit
c463583891
|
@ -389,9 +389,13 @@ 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 {
|
||||||
auto& aEl = this->map[a];
|
// Why return this->map[a] < this->map[b] does not work? Why it requires copy constructor?
|
||||||
auto& bEl = this->map[b];
|
auto itA = this->map.find(a);
|
||||||
return aEl < bEl;
|
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