@@ -451,7 +451,7 @@ void CheckClass::copyconstructors()
451451 }
452452 if (!funcDestructor || funcDestructor->isDefault ()) {
453453 const Token * mustDealloc = nullptr ;
454- for (std::map<int , const Token*>::const_iterator it = allocatedVars.begin (); it != allocatedVars.end (); ++it) {
454+ for (std::map<int , const Token*>::const_iterator it = allocatedVars.cbegin (); it != allocatedVars.cend (); ++it) {
455455 if (!Token::Match (it->second , " %var% [(=] new %type%" )) {
456456 mustDealloc = it->second ;
457457 break ;
@@ -1198,7 +1198,7 @@ static bool checkFunctionUsage(const Function *privfunc, const Scope* scope)
11981198 if (!scope)
11991199 return true ; // Assume it is used, if scope is not seen
12001200
1201- for (std::list<Function>::const_iterator func = scope->functionList .begin (); func != scope->functionList .end (); ++func) {
1201+ for (std::list<Function>::const_iterator func = scope->functionList .cbegin (); func != scope->functionList .cend (); ++func) {
12021202 if (func->functionScope ) {
12031203 if (Token::Match (func->tokenDef , " %name% (" )) {
12041204 for (const Token *ftok = func->tokenDef ->tokAt (2 ); ftok && ftok->str () != " )" ; ftok = ftok->next ()) {
@@ -1220,8 +1220,8 @@ static bool checkFunctionUsage(const Function *privfunc, const Scope* scope)
12201220 return true ;
12211221 }
12221222
1223- const std::map<std::string, Type*>::const_iterator end = scope->definedTypesMap .end ();
1224- for (std::map<std::string, Type*>::const_iterator iter = scope->definedTypesMap .begin (); iter != end; ++iter) {
1223+ const std::map<std::string, Type*>::const_iterator end = scope->definedTypesMap .cend ();
1224+ for (std::map<std::string, Type*>::const_iterator iter = scope->definedTypesMap .cbegin (); iter != end; ++iter) {
12251225 const Type *type = (*iter).second ;
12261226 if (type->enclosingScope == scope && checkFunctionUsage (privfunc, type->classScope ))
12271227 return true ;
@@ -1534,7 +1534,7 @@ void CheckClass::operatorEqRetRefThis()
15341534 return ;
15351535
15361536 for (const Scope * scope : mSymbolDatabase ->classAndStructScopes ) {
1537- for (std::list<Function>::const_iterator func = scope->functionList .begin (); func != scope->functionList .end (); ++func) {
1537+ for (std::list<Function>::const_iterator func = scope->functionList .cbegin (); func != scope->functionList .cend (); ++func) {
15381538 if (func->type == Function::eOperatorEqual && func->hasBody ()) {
15391539 // make sure return signature is correct
15401540 if (func->retType == func->nestedIn ->definedType && func->tokenDef ->strAt (-1 ) == " &" ) {
@@ -1582,7 +1582,7 @@ void CheckClass::checkReturnPtrThis(const Scope *scope, const Function *func, co
15821582 if (tok->strAt (2 ) == " (" &&
15831583 tok->linkAt (2 )->next ()->str () == " ;" ) {
15841584 // check if it is a member function
1585- for (std::list<Function>::const_iterator it = scope->functionList .begin (); it != scope->functionList .end (); ++it) {
1585+ for (std::list<Function>::const_iterator it = scope->functionList .cbegin (); it != scope->functionList .cend (); ++it) {
15861586 // check for a regular function with the same name and a body
15871587 if (it->type == Function::eFunction && it->hasBody () &&
15881588 it->token ->str () == tok->next ()->str ()) {
@@ -2523,7 +2523,7 @@ void CheckClass::initializerListOrder()
25232523 for (const Scope * scope : mSymbolDatabase ->classAndStructScopes ) {
25242524
25252525 // iterate through all member functions looking for constructors
2526- for (std::list<Function>::const_iterator func = scope->functionList .begin (); func != scope->functionList .end (); ++func) {
2526+ for (std::list<Function>::const_iterator func = scope->functionList .cbegin (); func != scope->functionList .cend (); ++func) {
25272527 if (func->isConstructor () && func->hasBody ()) {
25282528 // check for initializer list
25292529 const Token *tok = func->arg ->link ()->next ();
@@ -2861,7 +2861,7 @@ void CheckClass::checkCopyCtorAndEqOperator()
28612861 for (const Scope * scope : mSymbolDatabase ->classAndStructScopes ) {
28622862
28632863 bool hasNonStaticVars = false ;
2864- for (std::list<Variable>::const_iterator var = scope->varlist .begin (); var != scope->varlist .end (); ++var) {
2864+ for (std::list<Variable>::const_iterator var = scope->varlist .cbegin (); var != scope->varlist .cend (); ++var) {
28652865 if (!var->isStatic ()) {
28662866 hasNonStaticVars = true ;
28672867 break ;
0 commit comments