Refactoring: use range for

This commit is contained in:
Daniel Marjamäki 2018-04-30 22:10:54 +02:00
parent fce7a0a128
commit eb1571af81
1 changed files with 7 additions and 8 deletions

View File

@ -2401,18 +2401,17 @@ void CheckClass::checkCopyCtorAndEqOperator()
bool moveCtor = false; bool moveCtor = false;
CtorType assignmentOperators = CtorType::NO; CtorType assignmentOperators = CtorType::NO;
std::list<Function>::const_iterator func; for (const Function &func : scope->functionList) {
for (func = scope->functionList.begin(); func != scope->functionList.end(); ++func) { if (copyCtors == CtorType::NO && func.type == Function::eCopyConstructor) {
if (copyCtors == CtorType::NO && func->type == Function::eCopyConstructor) { copyCtors = func.hasBody() ? CtorType::WITH_BODY : CtorType::WITHOUT_BODY;
copyCtors = func->hasBody() ? CtorType::WITH_BODY : CtorType::WITHOUT_BODY;
} }
if (assignmentOperators == CtorType::NO && func->type == Function::eOperatorEqual) { if (assignmentOperators == CtorType::NO && func.type == Function::eOperatorEqual) {
const Variable * variable = func->getArgumentVar(0); const Variable * variable = func.getArgumentVar(0);
if (variable && variable->type() && variable->type()->classScope == scope) { if (variable && variable->type() && variable->type()->classScope == scope) {
assignmentOperators = func->hasBody() ? CtorType::WITH_BODY : CtorType::WITHOUT_BODY; assignmentOperators = func.hasBody() ? CtorType::WITH_BODY : CtorType::WITHOUT_BODY;
} }
} }
if (func->type == Function::eMoveConstructor) { if (func.type == Function::eMoveConstructor) {
moveCtor = true; moveCtor = true;
break; break;
} }