STYLE: direct iteration over dictionary entries

This commit is contained in:
Mark Olesen
2021-11-25 19:53:22 +01:00
parent bcf8a48c68
commit f459b11e24
6 changed files with 20 additions and 29 deletions

View File

@ -243,19 +243,18 @@ bool Foam::functionObjects::electricPotential::read(const dictionary& dict)
}
label phasei = 0;
forAllConstIters(phasesDict_, iter)
for (const entry& dEntry : phasesDict_)
{
const word& key = iter().keyword();
const word& key = dEntry.keyword();
if (!phasesDict_.isDict(key))
if (!dEntry.isDict())
{
FatalErrorInFunction
<< "Found non-dictionary entry " << iter()
<< " in top-level dictionary " << phasesDict_
<< exit(FatalError);
FatalIOErrorInFunction(phasesDict_)
<< "Entry " << key << " is not a dictionary" << nl
<< exit(FatalIOError);
}
const dictionary& subDict = phasesDict_.subDict(key);
const dictionary& subDict = dEntry.dict();
phaseNames_[phasei] = key;