[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 &&
+                              __desugars_to_v<__less_tag, key_compare, key_type, key_type> &&
+                              __is_transparently_comparable_v<key_type, __remove_cvref_t<_Arg> >,
+                          int> = 0>
+  _LIBCPP_HIDE_FROM_ABI inline mapped_type& at(_Arg&& __arg) {
----------------
ldionne wrote:

Do we need to have `inline` here, and if so, why?

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


More information about the libcxx-commits mailing list