[Lldb-commits] [PATCH] D150219: [lldb][NFCI] Remove n^2 loops and simplify iterator usage

Alex Langford via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue May 9 12:25:48 PDT 2023


bulbazord accepted this revision.
bulbazord added a comment.

I like this. :)



================
Comment at: lldb/source/Utility/Broadcaster.cpp:392
     }
-    m_event_map.erase(iter);
+    iter = m_event_map.erase(iter);
   }
----------------
I don't think you need to actually capture the iterator here? std::map::erase doesn't invalidate existing iterators* (so `begin` and `end` are fine) and we redefine `iter` at the beginning of this loop.

*:https://en.cppreference.com/w/cpp/container/map/erase


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D150219/new/

https://reviews.llvm.org/D150219



More information about the lldb-commits mailing list