Skip to content

Commit 153d9dd

Browse files
committed
refactor: replace qLowerBound & qUpperBound with std:: upper_bound & lower_bound
1 parent 59373e3 commit 153d9dd

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

src/qt/addresstablemodel.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ class AddressTablePriv
8888
QString::fromStdString(EncodeDestination(address.dest))));
8989
}
9090
}
91-
// qLowerBound() and qUpperBound() require our cachedAddressTable list to be sorted in asc order
91+
// std::lower_bound() and std::upper_bound() require our cachedAddressTable list to be sorted in asc order
9292
// Even though the map is already sorted this re-sorting step is needed because the originating map
9393
// is sorted by binary address, not by base58() address.
9494
std::sort(cachedAddressTable.begin(), cachedAddressTable.end(), AddressTableEntryLessThan());
@@ -97,9 +97,9 @@ class AddressTablePriv
9797
void updateEntry(const QString &address, const QString &label, bool isMine, const QString &purpose, int status)
9898
{
9999
// Find address / label in model
100-
QList<AddressTableEntry>::iterator lower = qLowerBound(
100+
QList<AddressTableEntry>::iterator lower = std::lower_bound(
101101
cachedAddressTable.begin(), cachedAddressTable.end(), address, AddressTableEntryLessThan());
102-
QList<AddressTableEntry>::iterator upper = qUpperBound(
102+
QList<AddressTableEntry>::iterator upper = std::upper_bound(
103103
cachedAddressTable.begin(), cachedAddressTable.end(), address, AddressTableEntryLessThan());
104104
int lowerIndex = (lower - cachedAddressTable.begin());
105105
int upperIndex = (upper - cachedAddressTable.begin());

src/qt/transactiontablemodel.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
#include <interfaces/handler.h>
1818
#include <uint256.h>
1919

20+
#include <algorithm>
21+
2022
#include <QColor>
2123
#include <QDateTime>
2224
#include <QDebug>
@@ -93,9 +95,9 @@ class TransactionTablePriv
9395
qDebug() << "TransactionTablePriv::updateWallet: " + QString::fromStdString(hash.ToString()) + " " + QString::number(status);
9496

9597
// Find bounds of this transaction in model
96-
QList<TransactionRecord>::iterator lower = qLowerBound(
98+
QList<TransactionRecord>::iterator lower = std::lower_bound(
9799
cachedWallet.begin(), cachedWallet.end(), hash, TxLessThan());
98-
QList<TransactionRecord>::iterator upper = qUpperBound(
100+
QList<TransactionRecord>::iterator upper = std::upper_bound(
99101
cachedWallet.begin(), cachedWallet.end(), hash, TxLessThan());
100102
int lowerIndex = (lower - cachedWallet.begin());
101103
int upperIndex = (upper - cachedWallet.begin());

0 commit comments

Comments
 (0)