From db85ec48c74d3cb41eb8a00defdd2ac4ced8014f Mon Sep 17 00:00:00 2001 From: Olxinos Date: Thu, 23 Apr 2020 16:23:59 +0100 Subject: [PATCH] Minor fixes to some std::sort calls (#3967) --- cockatrice/src/window_sets.cpp | 4 ++-- common/decklist.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cockatrice/src/window_sets.cpp b/cockatrice/src/window_sets.cpp index 5d0c5f79..02898c8b 100644 --- a/cockatrice/src/window_sets.cpp +++ b/cockatrice/src/window_sets.cpp @@ -364,7 +364,7 @@ void WndSets::actDown() { QModelIndexList rows = view->selectionModel()->selectedRows(); // QModelIndex only implements operator<, so we can't use std::greater - std::sort(rows.begin(), rows.end(), [](const QModelIndex &a, const QModelIndex &b) { return !(b < a); }); + std::sort(rows.begin(), rows.end(), [](const QModelIndex &a, const QModelIndex &b) { return b < a; }); QSet newRows; if (rows.empty()) @@ -412,7 +412,7 @@ void WndSets::actBottom() { QModelIndexList rows = view->selectionModel()->selectedRows(); // QModelIndex only implements operator<, so we can't use std::greater - std::sort(rows.begin(), rows.end(), [](const QModelIndex &a, const QModelIndex &b) { return !(b < a); }); + std::sort(rows.begin(), rows.end(), [](const QModelIndex &a, const QModelIndex &b) { return b < a; }); QSet newRows; int newRow = model->rowCount() - 1; diff --git a/common/decklist.cpp b/common/decklist.cpp index 0759cd96..deca0a32 100644 --- a/common/decklist.cpp +++ b/common/decklist.cpp @@ -254,7 +254,7 @@ public: } inline bool operator()(QPair a, QPair b) const { - return (order == Qt::AscendingOrder) ^ (a.second->compare(b.second)); + return (order == Qt::AscendingOrder) ? (b.second->compare(a.second)) : (a.second->compare(b.second)); } };