[libcxx-commits] [libcxx] [libc++] Eliminate extra allocations from `std::move(oss).str()` (PR #67294)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Wed Oct 11 06:30:18 PDT 2023


================
@@ -1329,6 +1324,20 @@ public:
     return assign(__sv.data(), __sv.size());
   }
 
+#if _LIBCPP_STD_VER >= 20
+  _LIBCPP_HIDE_FROM_ABI constexpr
+  void __move_assign(basic_string&& __str, size_type __pos, size_type __len) {
+    // Pilfer the allocation from __str.
----------------
ldionne wrote:

We should add a `_LIBCP_ASSERT_INTERNAL` for the precondition.

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


More information about the libcxx-commits mailing list