Cleanup: use a find_if().
authorCarl Hetherington <cth@carlh.net>
Fri, 14 Apr 2023 14:05:23 +0000 (16:05 +0200)
committerCarl Hetherington <cth@carlh.net>
Fri, 14 Apr 2023 14:05:23 +0000 (16:05 +0200)
src/dcp.cc

index 02ff048f882117c8fe2562f65eeccca8a4faca37..a73ebbf59461fa0ab45a625db83f5a20e3aa9e9f 100644 (file)
@@ -491,14 +491,7 @@ DCP::assets (bool ignore_unresolved) const
                        }
 
                        auto const id = j->asset_ref().id();
-                       auto already_got = false;
-                       for (auto k: assets) {
-                               if (k->id() == id) {
-                                       already_got = true;
-                               }
-                       }
-
-                       if (!already_got) {
+                       if (std::find_if(assets.begin(), assets.end(), [id](shared_ptr<Asset> asset) { return asset->id() == id; }) == assets.end()) {
                                auto o = j->asset_ref().asset();
                                assets.push_back (o);
                                /* More Interop special-casing */