[libcxx-commits] [libcxx] [libc++] Add a release note about multi{map, set}::find not returning the first element anymore (PR #155252)

Nico Weber via libcxx-commits libcxx-commits at lists.llvm.org
Mon Aug 25 08:16:17 PDT 2025


nico wrote:

Thanks!

As far as I can tell, libstdc++ also returns the first element from find():

https://github.com/gcc-mirror/gcc/blob/master/libstdc%2B%2B-v3/include/bits/stl_tree.h#L3166
https://github.com/gcc-mirror/gcc/blob/master/libstdc%2B%2B-v3/include/bits/stl_tree.h#L1936

As does MSVC's STL:

https://github.com/microsoft/STL/blob/main/stl/inc/xtree#L1395

So maybe say something like "libc++ is the first mainstream C++ standard library not returning the first element" to call this out more? I imagine it's going to be fairly ingrained.

For what it's worth, in Chromium all calls of `find()` I've found so far (so far just 2) wanted the first element. So maybe it might even make sense to change the spec to require this instead of changing implementation behavior 😅

(…for Chromium, it looks like it'll be feasible to just audit all callers, so I personally don't care all that much. But I imagine people with bigger code bases might have a harder time.)

https://github.com/llvm/llvm-project/pull/155252


More information about the libcxx-commits mailing list