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) {
const Scope * scope = symbolDatabase->classAndStructScopes[i];
// count the number of non-static variables
int vars = 0;
bool hasNonStaticVars = false;
for (std::list<Variable>::const_iterator var = scope->varlist.begin(); var != scope->varlist.end(); ++var) {
if (!var->isStatic())
vars++;
if (!var->isStatic()) {
hasNonStaticVars = true;
break;
}
}
if (vars == 0)
if (!hasNonStaticVars)
continue;
int hasCopyCtor = 0;