From d18fc5606fff53f19c51d7e244dbdc9a26b46b27 Mon Sep 17 00:00:00 2001 From: Vasilii Rogin <vasya@rogin.ru> Date: Mon, 15 May 2023 23:18:05 +0300 Subject: [PATCH] Improve lambda call --- src/sfall_arrays.cc | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/sfall_arrays.cc b/src/sfall_arrays.cc index 1b63957..ee724eb 100644 --- a/src/sfall_arrays.cc +++ b/src/sfall_arrays.cc @@ -447,13 +447,7 @@ void SFallArrayAssoc::MapSort(int type) if (sortByValue) { 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? - 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; + return map.at(a) < map.at(b); }); } else { ListSort(keys, type, std::less<ArrayElement>());