diff options
| author | Carl Hetherington <cth@carlh.net> | 2021-01-11 00:16:40 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2021-01-17 20:13:23 +0100 |
| commit | d95eacd3851a20e52202465ec22b4f72a4983dc8 (patch) | |
| tree | 1dfc1092ae7d2e6b6b7c313ad808415f578d9712 /tools/common.cc | |
| parent | cbee0d077e698541afcea82a95bafcea5245ab89 (diff) | |
Replace std::list with std::vector in the API.
Diffstat (limited to 'tools/common.cc')
| -rw-r--r-- | tools/common.cc | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/tools/common.cc b/tools/common.cc index ca3fd2c5..73d62679 100644 --- a/tools/common.cc +++ b/tools/common.cc @@ -34,22 +34,21 @@ #include "common.h" #include "dcp.h" -using std::list; -using std::shared_ptr; using std::dynamic_pointer_cast; +using std::shared_ptr; +using std::vector; void -dcp::filter_notes (list<dcp::VerificationNote>& notes, bool ignore_missing_assets) +dcp::filter_notes (vector<dcp::VerificationNote>& notes, bool ignore_missing_assets) { - for (list<dcp::VerificationNote>::iterator i = notes.begin(); i != notes.end(); ) { - - list<dcp::VerificationNote>::iterator tmp = i; - ++tmp; + if (!ignore_missing_assets) { + return; + } - if (ignore_missing_assets && (i->code() == dcp::VerificationNote::MISSING_ASSET || i->code() == dcp::VerificationNote::EXTERNAL_ASSET)) { - notes.erase (i); - } + vector<dcp::VerificationNote> filtered; + std::copy_if (notes.begin(), notes.end(), std::back_inserter(filtered), [](dcp::VerificationNote const& i) { + return i.code() != dcp::VerificationNote::MISSING_ASSET && i.code() != dcp::VerificationNote::EXTERNAL_ASSET; + }); - i = tmp; - } + notes = filtered; } |
