[libcxx-commits] [libcxx] [libc++] Avoid constructing additional objects when using map::at (PR #157866)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Mon Sep 15 08:27:22 PDT 2025


================
@@ -1085,6 +1094,30 @@ public:
   _LIBCPP_HIDE_FROM_ABI mapped_type& operator[](key_type&& __k);
 #  endif
 
+  template <class _Arg,
+            __enable_if_t<is_convertible<_Arg, value_type>::value &&
----------------
ldionne wrote:

```suggestion
            __enable_if_t<is_convertible<_Arg, key_type>::value &&
```

This also means we're missing some kind of coverage. The same issue applies to the `const&` version.

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


More information about the libcxx-commits mailing list