stdx::erase_if for stdx::unordered_map

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Fixed
    • Priority: Major - P3
    • 5.1.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Fully Compatible
    • ALL
    • v5.0, v4.9
    • Service Arch 2021-06-14
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Introduce a stdx::erase_if that properly handles absl::node_hash_map, which has the peculiar semantics that erase(pos) doesn't return an iterator but also doesn't change traversal order.

      Call this erase_if function to repair range based for loops where an element can be erased from the range, and similar code.

      This work must be done on its own merits as the codebase is currently suffering UB from these erased iterators, but it also unblocks abseil upgrade SERVER-51476.

      Similar to the fix in SERVER-57267.

      Abseil at head actually already has absl::erase_if overloads for the containers so we can bring that into stdx later.

              Assignee:
              Billy Donahue
              Reporter:
              Billy Donahue
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: