[all-commits] [llvm/llvm-project] a930d1: [libc++][vector<bool>] Tests shrink_to_fit require...

Mark de Wever via All-commits all-commits at lists.llvm.org
Wed Jul 24 00:25:13 PDT 2024


  Branch: refs/heads/release/19.x
  Home:   https://github.com/llvm/llvm-project
  Commit: a930d1f322674d03d9d88638a89fc4adcf3178b6
      https://github.com/llvm/llvm-project/commit/a930d1f322674d03d9d88638a89fc4adcf3178b6
  Author: Mark de Wever <koraq at xs4all.nl>
  Date:   2024-07-24 (Wed, 24 Jul 2024)

  Changed paths:
    M libcxx/test/std/containers/sequences/vector.bool/shrink_to_fit.pass.cpp

  Log Message:
  -----------
  [libc++][vector<bool>] Tests shrink_to_fit requirement. (#98009)

`vector<bool>`'s shrink_to_fit implementation is using the
"swap-to-free-container-resources-trick" which only shrinks when the
input vector is empty. Since the request to shrink_to_fit is
non-binding, this is a valid implementation. It is not a high-quality
implementation. Since `vector<bool>` is not a very popular container the
implementation has not been changed and only a test to validate the
non-growing property has been added.

This was discovered while investigating #95161.

(cherry picked from commit c2e438675754b83c31d7d5ba40cb13fe77e795de)



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list