aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2020-10-14 22:06:08 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2020-10-16 14:26:37 -0700
commit0c769b04b72a1805e1ffa32b4fca5f59fc98431a (patch)
tree78055261fc6358648d2b2d566c17ad27a5e51c01
parent8549f24c915b05e0e84e73d3d99e7888d3c7c063 (diff)
downloadsubsurface-0c769b04b72a1805e1ffa32b4fca5f59fc98431a.tar.gz
cleanup: replace std::find_if by std::any_of
To search for devices with the same model, we used find_if(). However, that was only to check whether such a thing exists, not to actually do something with said device. Therefore, change this to std::any_of() to make it clear what the purpose of the statement is. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
-rw-r--r--core/device.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/core/device.cpp b/core/device.cpp
index 4b2395509..4bfdd3ea4 100644
--- a/core/device.cpp
+++ b/core/device.cpp
@@ -314,10 +314,9 @@ extern "C" void set_dc_nickname(struct dive *dive, struct device_table *device_t
if (!empty_string(dc->model) && dc->deviceid &&
!get_device_for_dc(device_table, dc)) {
// we don't have this one, yet
- auto it = std::find_if(device_table->devices.begin(), device_table->devices.end(),
- [dc] (const device &dev)
- { return !strcasecmp(dev.model.c_str(), dc->model); });
- if (it != device_table->devices.end()) {
+ if (std::any_of(device_table->devices.begin(), device_table->devices.end(),
+ [dc] (const device &dev)
+ { return !strcasecmp(dev.model.c_str(), dc->model); })) {
// we already have this model but a different deviceid
std::string simpleNick(dc->model);
if (dc->deviceid == 0)