Make use of std algorithms

This commit is contained in:
Chocobo1 2019-01-11 16:05:57 +08:00
parent 40eb8a1f4a
commit 6d29a3af60
No known key found for this signature in database
GPG key ID: 210D9C873253A68C
10 changed files with 67 additions and 61 deletions

View file

@ -3460,18 +3460,18 @@ void Session::handleTorrentTrackerWarning(TorrentHandle *const torrent, const QS
bool Session::hasPerTorrentRatioLimit() const
{
for (TorrentHandle *const torrent : asConst(m_torrents))
if (torrent->ratioLimit() >= 0) return true;
return false;
return std::any_of(m_torrents.cbegin(), m_torrents.cend(), [](const TorrentHandle *torrent)
{
return (torrent->ratioLimit() >= 0);
});
}
bool Session::hasPerTorrentSeedingTimeLimit() const
{
for (TorrentHandle *const torrent : asConst(m_torrents))
if (torrent->seedingTimeLimit() >= 0) return true;
return false;
return std::any_of(m_torrents.cbegin(), m_torrents.cend(), [](const TorrentHandle *torrent)
{
return (torrent->seedingTimeLimit() >= 0);
});
}
void Session::initResumeFolder()