summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2022-11-11 16:26:04 +0100
committerMarc Mutz <marc.mutz@qt.io>2022-11-14 07:25:46 +0100
commit3cf6c7f6bf01fbd11a79fb2b05afb16a201aa953 (patch)
tree8eb3dd34cfbff1e711ec3736b03a5c1d59bd472d
parent783ff9da3267a5c4edcd185d9f91f8fdc9f7dcba (diff)
downloadqtserialport-3cf6c7f6bf01fbd11a79fb2b05afb16a201aa953.tar.gz
Port from qAsConst() to std::as_const()
We've been requiring C++17 since Qt 6.0, and our qAsConst use finally starts to bother us (QTBUG-99313), so time to port away from it now. Since qAsConst has exactly the same semantics as std::as_const (down to rvalue treatment, constexpr'ness and noexcept'ness), there's really nothing more to it than a global search-and-replace. This is a 6.4 re-run of the script we ran in dev, in order to avoid conflicts between the branches when cherry-picking. Change-Id: I5eca3df3179dfb2b2682c75a479ba9a4259cc703 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
-rw-r--r--src/serialport/qserialportinfo_freebsd.cpp4
-rw-r--r--tests/auto/qserialport/tst_qserialport.cpp2
2 files changed, 3 insertions, 3 deletions
diff --git a/src/serialport/qserialportinfo_freebsd.cpp b/src/serialport/qserialportinfo_freebsd.cpp
index bfc7989..5852cd7 100644
--- a/src/serialport/qserialportinfo_freebsd.cpp
+++ b/src/serialport/qserialportinfo_freebsd.cpp
@@ -284,10 +284,10 @@ QList<QSerialPortInfo> QSerialPortInfo::availablePorts()
QList<QSerialPortInfo> serialPortInfoList;
- for (const QSerialPortInfo &cuaCandidate : qAsConst(cuaCandidates)) {
+ for (const QSerialPortInfo &cuaCandidate : std::as_const(cuaCandidates)) {
const QString cuaPortName = cuaCandidate.portName();
const QString cuaToken = deviceProperty(cuaPortName, "cua");
- for (const QSerialPortInfo &ttyCandidate : qAsConst(ttyCandidates)) {
+ for (const QSerialPortInfo &ttyCandidate : std::as_const(ttyCandidates)) {
const QString ttyPortName = ttyCandidate.portName();
const QString ttyToken = deviceProperty(ttyPortName, "tty");
if (cuaToken != ttyToken)
diff --git a/tests/auto/qserialport/tst_qserialport.cpp b/tests/auto/qserialport/tst_qserialport.cpp
index 3ee4480..9613208 100644
--- a/tests/auto/qserialport/tst_qserialport.cpp
+++ b/tests/auto/qserialport/tst_qserialport.cpp
@@ -247,7 +247,7 @@ void tst_QSerialPort::openExisting()
QFETCH(bool, openResult);
QFETCH(QSerialPort::SerialPortError, errorCode);
- for (const QString &serialPortName : qAsConst(m_availablePortNames)) {
+ for (const QString &serialPortName : std::as_const(m_availablePortNames)) {
QSerialPort serialPort(serialPortName);
QSignalSpy errorSpy(&serialPort, &QSerialPort::errorOccurred);
QVERIFY(errorSpy.isValid());