Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-57477

stdx::erase_if for stdx::unordered_map

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 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

      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@mongodb.com Billy Donahue
            Reporter:
            billy.donahue@mongodb.com Billy Donahue
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: