No need for counting here

This commit is contained in:
Dmitry-Me 2017-08-14 18:06:23 +03:00
parent 2ea8754088
commit b995e59ff2
1 changed files with 6 additions and 5 deletions

View File

@ -2383,13 +2383,14 @@ void CheckClass::checkCopyCtorAndEqOperator()
for (std::size_t i = 0; i < classes; ++i) { for (std::size_t i = 0; i < classes; ++i) {
const Scope * scope = symbolDatabase->classAndStructScopes[i]; const Scope * scope = symbolDatabase->classAndStructScopes[i];
// count the number of non-static variables bool hasNonStaticVars = false;
int vars = 0;
for (std::list<Variable>::const_iterator var = scope->varlist.begin(); var != scope->varlist.end(); ++var) { for (std::list<Variable>::const_iterator var = scope->varlist.begin(); var != scope->varlist.end(); ++var) {
if (!var->isStatic()) if (!var->isStatic()) {
vars++; hasNonStaticVars = true;
break;
}
} }
if (vars == 0) if (!hasNonStaticVars)
continue; continue;
int hasCopyCtor = 0; int hasCopyCtor = 0;