mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-28 20:25:34 +08:00
incidental simplification
This commit is contained in:
@@ -43,12 +43,10 @@ namespace BlackMisc
|
|||||||
*/
|
*/
|
||||||
int CAudioDeviceList::count(CAudioDevice::DeviceType type) const
|
int CAudioDeviceList::count(CAudioDevice::DeviceType type) const
|
||||||
{
|
{
|
||||||
int c = 0;
|
return std::count_if(this->begin(), this->end(), [type](const CAudioDevice &device)
|
||||||
foreach(CAudioDevice device, *this)
|
|
||||||
{
|
{
|
||||||
if (device.getType() == type) c++;
|
return device.getType() == type;
|
||||||
}
|
});
|
||||||
return c;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -86,19 +86,10 @@ namespace BlackMisc
|
|||||||
*/
|
*/
|
||||||
void CAirportList::removeIfOutsideRange(const Geo::CCoordinateGeodetic &position, const CLength &maxDistance, bool updateValues)
|
void CAirportList::removeIfOutsideRange(const Geo::CCoordinateGeodetic &position, const CLength &maxDistance, bool updateValues)
|
||||||
{
|
{
|
||||||
CLength d;
|
this->removeIf([ & ](CAirport &airport)
|
||||||
for (CAirportList::iterator i = begin(); i != end();)
|
|
||||||
{
|
{
|
||||||
d = i->calculcateDistanceAndBearingToPlane(position, updateValues);
|
return airport.calculcateDistanceAndBearingToPlane(position, updateValues) > maxDistance;
|
||||||
if (maxDistance < d)
|
});
|
||||||
{
|
|
||||||
i = this->erase(i);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
++i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} // namespace
|
} // namespace
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|||||||
@@ -132,12 +132,7 @@ namespace BlackMisc
|
|||||||
void CTextMessageList::toggleSenderRecipients()
|
void CTextMessageList::toggleSenderRecipients()
|
||||||
{
|
{
|
||||||
if (this->isEmpty()) return;
|
if (this->isEmpty()) return;
|
||||||
for (int i = 0; i < this->size(); i++)
|
std::for_each(this->begin(), this->end(), [](CTextMessage &tm) { tm.toggleSenderRecipient(); });
|
||||||
{
|
|
||||||
CTextMessage tm = (*this)[i];
|
|
||||||
tm.toggleSenderRecipient();
|
|
||||||
(*this)[i] = tm;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|||||||
Reference in New Issue
Block a user