]> granicus.if.org Git - libmatroska/commitdiff
manual find_if conversion
authorRosen Penev <rosenp@gmail.com>
Mon, 26 Sep 2022 22:55:09 +0000 (15:55 -0700)
committerRosen Penev <rosenp@gmail.com>
Sun, 2 Oct 2022 20:56:40 +0000 (13:56 -0700)
Signed-off-by: Rosen Penev <rosenp@gmail.com>
src/KaxSeekHead.cpp

index 019ea370d336367bccc39ec6d6d180dc21a1eb8f..5941f9f3751187562d0b66e87d95af7fc338e52c 100644 (file)
@@ -89,16 +89,12 @@ KaxSeek * KaxSeekHead::FindNextOf(const KaxSeek &aPrev) const
   KaxSeek *tmp;
 
   // look for the previous in the list
-  for (Itr = begin(); Itr != end(); ++Itr) {
-    if (*Itr == static_cast<const EbmlElement*>(&aPrev))
-      break;
-  }
-
-  if (Itr != end()) {
-    ++Itr;
-    for (; Itr != end(); ++Itr) {
-      if (EbmlId(*(*Itr)) == EBML_ID(KaxSeek)) {
-        tmp = static_cast<KaxSeek *>(*Itr);
+  auto it = std::find_if(this->begin(), this->end(), [&](auto e){ return e == static_cast<const EbmlElement*>(&aPrev); });
+  if (it != end()) {
+    ++it;
+    for (; it != end(); ++it) {
+      if (EbmlId(*(*it)) == EBML_ID(KaxSeek)) {
+        tmp = static_cast<KaxSeek *>(*it);
         if (tmp->IsEbmlId(aPrev))
           return tmp;
       }