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:
Marc Mutz
2022-10-07 14:46:06 +02:00
parent 90de29d530
commit 8eb4d52342
498 changed files with 1270 additions and 1270 deletions

View File

@@ -31,7 +31,7 @@ BaseFileWizard::BaseFileWizard(const BaseFileWizardFactory *factory,
m_extraValues(extraValues),
m_factory(factory)
{
for (IFileWizardExtension *extension : qAsConst(g_fileWizardExtensions))
for (IFileWizardExtension *extension : std::as_const(g_fileWizardExtensions))
m_extensionPages += extension->extensionPages(factory);
if (!m_extensionPages.empty())
@@ -44,7 +44,7 @@ void BaseFileWizard::initializePage(int id)
if (page(id) == m_firstExtensionPage) {
generateFileList();
for (IFileWizardExtension *ex : qAsConst(g_fileWizardExtensions))
for (IFileWizardExtension *ex : std::as_const(g_fileWizardExtensions))
ex->firstExtensionPageShown(m_files, m_extraValues);
}
}
@@ -74,7 +74,7 @@ void BaseFileWizard::accept()
break;
}
for (IFileWizardExtension *ex : qAsConst(g_fileWizardExtensions)) {
for (IFileWizardExtension *ex : std::as_const(g_fileWizardExtensions)) {
for (int i = 0; i < m_files.count(); i++) {
ex->applyCodeStyle(&m_files[i]);
}
@@ -89,7 +89,7 @@ void BaseFileWizard::accept()
bool removeOpenProjectAttribute = false;
// Run the extensions
for (IFileWizardExtension *ex : qAsConst(g_fileWizardExtensions)) {
for (IFileWizardExtension *ex : std::as_const(g_fileWizardExtensions)) {
bool remove;
if (!ex->processFiles(m_files, &remove, &errorMessage)) {
if (!errorMessage.isEmpty())