Using first or default #414

This commit is contained in:
Klaus Basan
2015-06-03 16:18:31 +02:00
parent 18f803b214
commit e822c9f7d2
2 changed files with 2 additions and 6 deletions

View File

@@ -74,11 +74,7 @@ namespace BlackMisc
template <class OBJ, class CONTAINER>
OBJ ICallsignObjectList<OBJ, CONTAINER>::findFirstByCallsign(const CCallsign &callsign, const OBJ &ifNotFound) const
{
for (const OBJ &callsignObj : this->container())
{
if (callsignObj.getCallsign() == callsign) { return callsignObj; }
}
return ifNotFound;
return this->container().findFirstByOrDefault(&OBJ::getCallsign, callsign, ifNotFound);
}
template <class OBJ, class CONTAINER>