mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
STYLE: use range-for when looping dictionary entries.
- as part of the cleanup of dictionary access methods (c6520033c9)
made the dictionary class single inheritance from IDLList<entry>.
This eliminates any ambiguities for iterators and allows
for simple use of range-for looping.
Eg,
for (const entry& e : topDict))
{
Info<< "entry:" << e.keyword() << " is dict:" << e.isDict() << nl;
}
vs
forAllConstIter(dictionary, topDict, iter))
{
Info<< "entry:" << iter().keyword()
<< " is dict:" << iter().isDict() << nl;
}
This commit is contained in:
@ -84,12 +84,12 @@ int main(int argc, char *argv[])
|
||||
|
||||
const dictionary& surfacesDict = meshDict.subDict("surfaces");
|
||||
|
||||
forAllConstIter(dictionary, surfacesDict, surfacesIter)
|
||||
for (const entry& dEntry : surfacesDict)
|
||||
{
|
||||
if (surfacesIter().isDict())
|
||||
if (dEntry.isDict())
|
||||
{
|
||||
const word& surfName = surfacesIter().keyword();
|
||||
const dictionary& surfDict = surfacesIter().dict();
|
||||
const word& surfName = dEntry.keyword();
|
||||
const dictionary& surfDict = dEntry.dict();
|
||||
|
||||
// Look up surface
|
||||
searchableSurface& surf = allGeometry[surfName];
|
||||
@ -120,10 +120,11 @@ int main(int argc, char *argv[])
|
||||
if (surfDict.found("regions"))
|
||||
{
|
||||
const dictionary& regionsDict = surfDict.subDict("regions");
|
||||
forAllConstIter(dictionary, regionsDict, regionsIter)
|
||||
|
||||
for (const entry& e : regionsDict)
|
||||
{
|
||||
const dictionary& regionDict = regionsIter().dict();
|
||||
const keyType& regionName = regionsIter().keyword();
|
||||
const keyType& regionName = e.keyword();
|
||||
const dictionary& regionDict = e.dict();
|
||||
|
||||
autoPtr<searchableSurfaceModifier> modifier
|
||||
(
|
||||
|
||||
Reference in New Issue
Block a user