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

stdx::erase_if for stdx::unordered_map

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major - P3 Major - P3
    • 5.1.0-rc0
    • None
    • None
    • None
    • Fully Compatible
    • ALL
    • v5.0, v4.9
    • Service Arch 2021-06-14

    Description

      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.

      Attachments

        Activity

          People

            billy.donahue@mongodb.com Billy Donahue
            billy.donahue@mongodb.com Billy Donahue
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: