• Jan Wilken Doerrie's avatar
    [base] Return size_t from Erase and EraseIf · af2a0d59
    Jan Wilken Doerrie authored
    This change modifies base's implementation of C++20's uniform container
    erasure API to reflect the latest changes from the committee meeting in
    Prague. In particular, these functions now return the number of erased
    elements, rather than having no return value. Differences from the
    standard [1]:
    
    - For simplicity, base::Erase and base::EraseIf return size_t, rather
      than typename Container::size_type.
    - Since std::forward_list::remove_if only returns size_type starting
      from C++20, the respective overloads need to perform two extra O(n)
      operations to calculate the number of removed elements.
    
    [1] https://wg21.link/p1115
    
    Bug: 697235
    Change-Id: I30ad6ce08f3a37eddd1483e4fdc4f1cd8d155d2b
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2072038Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
    Commit-Queue: Jan Wilken Dörrie <jdoerrie@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#744996}
    af2a0d59
stl_util_unittest.cc 22.9 KB