diff options
author | Marc Mutz <marc.mutz@qt.io> | 2022-10-06 11:30:50 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@qt.io> | 2022-10-07 23:38:56 +0200 |
commit | c2d490a2385ea6f389340a296acaac0fa198c8b9 (patch) | |
tree | 5bc4dc681c9a9501cb9b2f39b8a1ab6e3d76ccfd /src/qml/qml/qqmlmetatype.cpp | |
parent | 958cd3ee1094a068b6d0ff27c73a4b3caff088ad (diff) |
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.
Task-number: QTBUG-99313
Change-Id: I601bf70f020f511019ed28731ba53b14b765dbf0
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'src/qml/qml/qqmlmetatype.cpp')
-rw-r--r-- | src/qml/qml/qqmlmetatype.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/qml/qml/qqmlmetatype.cpp b/src/qml/qml/qqmlmetatype.cpp index 1ee87713a6..a8d0eaa825 100644 --- a/src/qml/qml/qqmlmetatype.cpp +++ b/src/qml/qml/qqmlmetatype.cpp @@ -840,7 +840,7 @@ QQmlMetaType::RegistrationResult QQmlMetaType::registerPluginTypes( if (!failures.isEmpty()) { if (errors) { - for (const QString &failure : qAsConst(failures)) { + for (const QString &failure : std::as_const(failures)) { QQmlError error; error.setDescription(failure); errors->prepend(error); @@ -1418,7 +1418,7 @@ void QQmlMetaType::registerMetaObjectForType(const QMetaObject *metaobject, QQml static bool hasActiveInlineComponents(const QQmlTypePrivate *d) { - for (const QQmlType &ic : qAsConst(d->objectIdToICType)) { + for (const QQmlType &ic : std::as_const(d->objectIdToICType)) { const QQmlTypePrivate *icPriv = ic.priv(); if (icPriv && icPriv->count() > 1) return true; @@ -1525,7 +1525,7 @@ QList<QQmlType> QQmlMetaType::qmlSingletonTypes() const QQmlMetaTypeDataPtr data; QList<QQmlType> retn; - for (const auto t : qAsConst(data->nameToType)) { + for (const auto t : std::as_const(data->nameToType)) { QQmlType type(t); if (type.isSingleton()) retn.append(type); @@ -1537,7 +1537,7 @@ const QQmlPrivate::CachedQmlUnit *QQmlMetaType::findCachedCompilationUnit(const { const QQmlMetaTypeDataPtr data; - for (const auto lookup : qAsConst(data->lookupCachedQmlUnit)) { + for (const auto lookup : std::as_const(data->lookupCachedQmlUnit)) { if (const QQmlPrivate::CachedQmlUnit *unit = lookup(uri)) { QString error; if (!QV4::ExecutableCompilationUnit::verifyHeader(unit->qmlData, QDateTime(), &error)) { |