Introduce static_container_cast

Casting all elements of a container, similar to qobject_container_cast.

Change-Id: Ib455fe8c7fa0d4acda7e29685c3100638a0152f8
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
Eike Ziller
2018-05-29 10:59:27 +02:00
parent 7ad738d236
commit bb28b10add
5 changed files with 21 additions and 9 deletions

View File

@@ -1032,9 +1032,7 @@ void AndroidConfigurations::updateAutomaticKitList()
&& tc->typeId() == Constants::ANDROID_TOOLCHAIN_ID
&& !static_cast<const AndroidToolChain *>(tc)->isSecondaryToolChain();
});
const QList<AndroidToolChain *> toolchains = Utils::transform(tmp, [](ToolChain *tc) {
return static_cast<AndroidToolChain *>(tc);
});
const auto toolchains = Utils::static_container_cast<AndroidToolChain *>(tmp);
for (AndroidToolChain *tc : toolchains) {
if (tc->isSecondaryToolChain() || tc->language() != Core::Id(ProjectExplorer::Constants::CXX_LANGUAGE_ID))
continue;