@@ -4409,15 +4409,9 @@ Scope::Scope(const SymbolDatabase *check_, const Token *classDef_, const Scope *
44094409
44104410bool Scope::hasDefaultConstructor () const
44114411{
4412- if (numConstructors) {
4413- std::list<Function>::const_iterator func;
4414-
4415- for (func = functionList.cbegin (); func != functionList.cend (); ++func) {
4416- if (func->type == Function::eConstructor && func->argCount () == 0 )
4417- return true ;
4418- }
4419- }
4420- return false ;
4412+ return numConstructors > 0 && std::any_of (functionList.begin (), functionList.end (), [](const Function& func) {
4413+ return func.type == Function::eConstructor && func.argCount () == 0 ;
4414+ });
44214415}
44224416
44234417AccessControl Scope::defaultAccess () const
@@ -5584,6 +5578,8 @@ const Function* SymbolDatabase::findFunction(const Token *tok) const
55845578 return var->typeScope ()->findFunction (tok, var->valueType ()->constness == 1 );
55855579 if (var && var->smartPointerType () && var->smartPointerType ()->classScope && tok1->next ()->originalName () == " ->" )
55865580 return var->smartPointerType ()->classScope ->findFunction (tok, var->valueType ()->constness == 1 );
5581+ if (var && var->iteratorType () && var->iteratorType ()->classScope && tok1->next ()->originalName () == " ->" )
5582+ return var->iteratorType ()->classScope ->findFunction (tok, var->valueType ()->constness == 1 );
55875583 } else if (Token::simpleMatch (tok->previous ()->astOperand1 (), " (" )) {
55885584 const Token *castTok = tok->previous ()->astOperand1 ();
55895585 if (castTok->isCast ()) {
@@ -6280,12 +6276,11 @@ void SymbolDatabase::setValueType(Token* tok, const ValueType& valuetype, Source
62806276 const Scope *typeScope = vt1->typeScope ;
62816277 if (!typeScope)
62826278 return ;
6283- for (std::list<Variable>::const_iterator it = typeScope->varlist .cbegin (); it != typeScope->varlist .cend (); ++it) {
6284- if (it->nameToken ()->str () == name) {
6285- var = &*it;
6286- break ;
6287- }
6288- }
6279+ auto it = std::find_if (typeScope->varlist .begin (), typeScope->varlist .end (), [&name](const Variable& v) {
6280+ return v.nameToken ()->str () == name;
6281+ });
6282+ if (it != typeScope->varlist .end ())
6283+ var = &*it;
62896284 }
62906285 if (var)
62916286 setValueType (parent, *var);
0 commit comments