[libcxx-commits] [libcxx] [libc++] Add a release note about multi{map, set}::find not returning the first element anymore (PR #155252)
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Aug 25 08:55:07 PDT 2025
================
@@ -61,6 +61,10 @@ Deprecations and Removals
Potentially breaking changes
----------------------------
+- The algorithm for ``multi{map,set}::find`` has been modified, which doesn't guarantee that the first element is
+ returned. If code relies on the first element being returned from ``find`` it may be broken. To fix it use
+ ``lower_bound`` or ``equal_range`` instead.
----------------
ldionne wrote:
```suggestion
- The algorithm for ``multi{map,set}::find`` has been modified such that it doesn't necessarily return an iterator to the first equal element in the container. This was never guaranteed by the Standard, but libc++ previously happened to always return the first equal element, like other implementations do. Starting with this release, code relying on the first element being returned from ``find`` will be broken, and ``lower_bound`` or ``equal_range`` should be used instead.
```
https://github.com/llvm/llvm-project/pull/155252
More information about the libcxx-commits
mailing list