Skip to content

Commit 06e5836

Browse files
committed
Use find_if
1 parent afef2a3 commit 06e5836

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

‎lib/templatesimplifier.cpp‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -944,10 +944,12 @@ static bool deducedTypeIsShadowed(const Scope* from, const DeducedType& deduced)
944944
else
945945
lookupScopes.push_back(scope);
946946
for (const Scope* lookupScope : lookupScopes) {
947-
for (const Scope* nested : lookupScope->nestedList) {
948-
if (nested->className == name)
949-
return nested != outermost;
950-
}
947+
const std::vector<Scope*>& nestedList = lookupScope->nestedList;
948+
const auto it = std::find_if(nestedList.cbegin(), nestedList.cend(), [&](const Scope* nested) {
949+
return nested->className == name;
950+
});
951+
if (it != nestedList.cend())
952+
return *it != outermost;
951953
}
952954
}
953955
return false;

0 commit comments

Comments
 (0)