[libcxx-commits] [libcxx] [libc++] Optimize multi{map, set}::insert(InputIterator, InputIterator) (PR #152691)

Nikolas Klauser via libcxx-commits libcxx-commits at lists.llvm.org
Thu Aug 14 02:25:55 PDT 2025


================
@@ -970,6 +970,36 @@ public:
     __emplace_hint_multi(__p, std::move(__value));
   }
 
+  template <class _InIter, class _Sent>
+  _LIBCPP_HIDE_FROM_ABI void __insert_range_multi(_InIter __first, _Sent __last) {
----------------
philnik777 wrote:

It turns out that adding a unique implementation will be a lot more complex, since we have a lot more complex handling in `__emplace_unique` to avoid unnecessary allocations if the node already exists. I think it would be better to refactor `__emplace_unique` to make that simpler first and then tackle `__insert_range_unique` (or a merged version) separately.

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


More information about the libcxx-commits mailing list