mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-05 17:35:34 +08:00
Using first or default #414
This commit is contained in:
@@ -32,7 +32,7 @@ namespace BlackMisc
|
||||
|
||||
CAirport CAirportList::findFirstByIcao(const CAirportIcaoCode &icao, const CAirport &ifNotFound) const
|
||||
{
|
||||
return this->findByIcao(icao).frontOrDefault(ifNotFound);
|
||||
return this->findFirstByOrDefault(&CAirport::getIcao, icao, ifNotFound);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user