Specify CPL standard on construction.
[libdcp.git] / tools / common.cc
index 0238a8cc09469182acc896e0a027f9fb6308183a..54bee6b5c9a1f217983c9c8ac8b665680f2ec15a 100644 (file)
 #include "common.h"
 #include "dcp.h"
 
-using std::list;
-using boost::shared_ptr;
-using boost::dynamic_pointer_cast;
+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::Code::MISSING_ASSET && i.code() != dcp::VerificationNote::Code::EXTERNAL_ASSET;
+       });
 
-               i = tmp;
-       }
+       notes = filtered;
 }