mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-19 23:17:21 -06:00
Utilize algorithms from std::ranges
The result is shorter code and improves readability. Note that `asConst()` is still required for non-const containers, otherwise the container will detach. PR #23342.
This commit is contained in:
@@ -980,7 +980,7 @@ void AppController::setPreferencesAction()
|
||||
const QString ifaceValue {it.value().toString()};
|
||||
|
||||
const QList<QNetworkInterface> ifaces = QNetworkInterface::allInterfaces();
|
||||
const auto ifacesIter = std::find_if(ifaces.cbegin(), ifaces.cend(), [&ifaceValue](const QNetworkInterface &iface)
|
||||
const auto ifacesIter = std::ranges::find_if(ifaces, [&ifaceValue](const QNetworkInterface &iface)
|
||||
{
|
||||
return (!iface.addressEntries().isEmpty()) && (iface.name() == ifaceValue);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user