From: Carl Hetherington Date: Sun, 28 May 2023 00:12:03 +0000 (+0200) Subject: Cleanup: use find_if(). X-Git-Tag: v1.8.70~1 X-Git-Url: https://main.carlh.net/gitweb/?a=commitdiff_plain;ds=sidebyside;h=af8a3bcc86e89afac79ee6bda3fea811f25f3cc8;p=libdcp.git Cleanup: use find_if(). --- diff --git a/src/interop_subtitle_asset.cc b/src/interop_subtitle_asset.cc index 8fb115a7..0116c11c 100644 --- a/src/interop_subtitle_asset.cc +++ b/src/interop_subtitle_asset.cc @@ -214,13 +214,10 @@ InteropSubtitleAsset::write (boost::filesystem::path p) const /* Fonts */ for (auto i: _load_font_nodes) { auto file = p.parent_path() / i->uri; - auto j = _fonts.begin(); - while (j != _fonts.end() && j->load_id != i->id) { - ++j; - } - if (j != _fonts.end ()) { - j->data.write (file); - j->file = file; + auto font_with_id = std::find_if(_fonts.begin(), _fonts.end(), [i](Font const& font) { return font.load_id == i->id; }); + if (font_with_id != _fonts.end()) { + font_with_id->data.write(file); + font_with_id->file = file; } } }