From e822c9f7d29b8cadb91dc0548cd6f5182460accd Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Wed, 3 Jun 2015 16:18:31 +0200 Subject: [PATCH] Using first or default #414 --- src/blackmisc/aviation/airportlist.cpp | 2 +- src/blackmisc/aviation/callsignobjectlist.cpp | 6 +----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/blackmisc/aviation/airportlist.cpp b/src/blackmisc/aviation/airportlist.cpp index 450dd2d03..89e329624 100644 --- a/src/blackmisc/aviation/airportlist.cpp +++ b/src/blackmisc/aviation/airportlist.cpp @@ -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 diff --git a/src/blackmisc/aviation/callsignobjectlist.cpp b/src/blackmisc/aviation/callsignobjectlist.cpp index e4c2a7d45..0d7c67bb5 100644 --- a/src/blackmisc/aviation/callsignobjectlist.cpp +++ b/src/blackmisc/aviation/callsignobjectlist.cpp @@ -74,11 +74,7 @@ namespace BlackMisc template OBJ ICallsignObjectList::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