Modernizing countObjectsOfType functions
This commit is contained in:
@@ -4397,14 +4397,9 @@ Document::findObjects(const Base::Type& typeId, const char* objname, const char*
|
||||
|
||||
int Document::countObjectsOfType(const Base::Type& typeId) const
|
||||
{
|
||||
int ct = 0;
|
||||
for (const auto& it : d->objectMap) {
|
||||
if (it.second->getTypeId().isDerivedFrom(typeId)) {
|
||||
ct++;
|
||||
}
|
||||
}
|
||||
|
||||
return ct;
|
||||
return std::count_if(d->objectMap.begin(), d->objectMap.end(), [&](const auto& it) {
|
||||
return it.second->getTypeId().isDerivedFrom(typeId);
|
||||
});
|
||||
}
|
||||
|
||||
int Document::countObjectsOfType(const char* typeName) const
|
||||
|
||||
Reference in New Issue
Block a user