[libcxx-commits] [PATCH] D72704: Optimize basic_string::operator=(const basic_string&) for SSO assignments
Martijn Vels via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Jan 14 09:08:57 PST 2020
mvels updated this revision to Diff 237998.
mvels added a comment.
- Fix __assign() --> assign()
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D72704/new/
https://reviews.llvm.org/D72704
Files:
libcxx/include/string
Index: libcxx/include/string
===================================================================
--- libcxx/include/string
+++ libcxx/include/string
@@ -2260,7 +2260,14 @@
if (this != &__str)
{
__copy_assign_alloc(__str);
- return assign(__str.data(), __str.size());
+ if (__str.__is_long()) {
+ return assign(__str.data(), __str.size());
+ }
+ if (__is_long()) {
+ __alloc_traits::deallocate(__alloc(), __get_long_pointer(),
+ __get_long_cap());
+ }
+ __r_.first().__r = __str.__r_.first().__r;
}
return *this;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D72704.237998.patch
Type: text/x-patch
Size: 646 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20200114/fd2b6cdf/attachment.bin>
More information about the libcxx-commits
mailing list