[libcxx-commits] [libcxx] [libc++] Optimize vector::erase (PR #213916)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Wed Aug 12 07:20:36 PDT 2026


================
@@ -431,6 +431,44 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void __uninitialized_allocat
   }
 }
 
+// __uninitialized_allocator_relocate_forward relocates the objects in [__first, __last) into __result
+// element-by-element from __first to __last. Relocation means that the objects in [__first, __last) are placed into
+// __result as-if by move-construct and destroy, except that the move constructor and destructor may never be called if
+// they are known to be equivalent to a memcpy.
+//
+// Preconditions:  At __result there is no object and [__first, __last) contains objects
+// Postconditions: __result contains the objects from [__first, __last) and
+//                 [__first, __last) doesn't contain any objects
+//
+// The strong exception guarantee is provided.
----------------
ldionne wrote:

```suggestion
```

I don't think we can or should actually provide this guarantee here.

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


More information about the libcxx-commits mailing list