forked from qt-creator/qt-creator
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: I88edd91395849574436299b8badda21bb93bea39 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -510,7 +510,7 @@ QList<void *> CMakeProjectImporter::examineDirectory(const FilePath &importPath,
|
||||
buildConfigurationTypes = buildConfigurationTypesString.split(';');
|
||||
}
|
||||
|
||||
for (auto const &buildType: qAsConst(buildConfigurationTypes)) {
|
||||
for (auto const &buildType: std::as_const(buildConfigurationTypes)) {
|
||||
auto data = std::make_unique<DirectoryData>();
|
||||
|
||||
data->cmakeHomeDirectory =
|
||||
@@ -745,7 +745,7 @@ void CMakeProjectPlugin::testCMakeProjectImporterQt()
|
||||
QFETCH(QString, expectedQmake);
|
||||
|
||||
CMakeConfig config;
|
||||
for (const QString &c : qAsConst(cache)) {
|
||||
for (const QString &c : std::as_const(cache)) {
|
||||
const int pos = c.indexOf('=');
|
||||
Q_ASSERT(pos > 0);
|
||||
const QString key = c.left(pos);
|
||||
@@ -802,7 +802,7 @@ void CMakeProjectPlugin::testCMakeProjectImporterToolChain()
|
||||
QCOMPARE(expectedLanguages.count(), expectedToolChains.count());
|
||||
|
||||
CMakeConfig config;
|
||||
for (const QString &c : qAsConst(cache)) {
|
||||
for (const QString &c : std::as_const(cache)) {
|
||||
const int pos = c.indexOf('=');
|
||||
Q_ASSERT(pos > 0);
|
||||
const QString key = c.left(pos);
|
||||
|
||||
Reference in New Issue
Block a user