QtCore platform code: s/QPair/std::pair/

Also port qMakePair() to just braced initialization and CTAD.

Task-number: QTBUG-115841
Change-Id: I46ee214ab47513375a6e28e3b439c7b060581235
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit 87361727ffafbee460970cdb8e72056653fd2443)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Marc Mutz 2023-12-12 10:04:07 +01:00 committed by Qt Cherry-pick Bot
parent 02eb5e6d30
commit 2d5a239285
4 changed files with 5 additions and 6 deletions

View File

@ -25,7 +25,6 @@
#include "qendian.h"
#include "qhash.h"
#include "qpair.h"
#include "qmutex.h"
#include "qvarlengtharray.h"
#include "private/qlocking_p.h"
@ -715,7 +714,7 @@ QMacVersion::VersionTuple QMacVersion::versionsForImage(const mach_header *machH
};
static auto makeVersionTuple = [](uint32_t dt, uint32_t sdk, QOperatingSystemVersion::OSType osType) {
return qMakePair(
return std::pair(
QOperatingSystemVersion(osType, dt >> 16 & 0xffff, dt >> 8 & 0xff, dt & 0xff),
QOperatingSystemVersion(osType, sdk >> 16 & 0xffff, sdk >> 8 & 0xff, sdk & 0xff)
);

View File

@ -436,7 +436,7 @@ public:
private:
QMacVersion() = default;
using VersionTuple = QPair<QOperatingSystemVersion, QOperatingSystemVersion>;
using VersionTuple = std::pair<QOperatingSystemVersion, QOperatingSystemVersion>;
static VersionTuple versionsForImage(const mach_header *machHeader);
static VersionTuple applicationVersion();
static VersionTuple libraryVersion();

View File

@ -125,10 +125,10 @@ QString QWinRegistryKey::stringValue(QStringView subKey) const
return value<QString>(subKey).value_or(QString());
}
QPair<DWORD, bool> QWinRegistryKey::dwordValue(QStringView subKey) const
std::pair<DWORD, bool> QWinRegistryKey::dwordValue(QStringView subKey) const
{
const std::optional<DWORD> val = value<DWORD>(subKey);
return qMakePair(val.value_or(0), val.has_value());
return {val.value_or(0), val.has_value()};
}
QT_END_NAMESPACE

View File

@ -58,7 +58,7 @@ public:
// ### TODO: Remove once all usages are migrated to new interface.
QString stringValue(QStringView subKey) const;
QPair<DWORD, bool> dwordValue(QStringView subKey) const;
std::pair<DWORD, bool> dwordValue(QStringView subKey) const;
private:
HKEY m_key = nullptr;