mirror of
https://github.com/abseil/abseil-cpp.git
synced 2026-06-04 20:14:23 +08:00
The previous code was using memmove under the hood (string::append).
This patch makes it use `memcpy` for performance and consistency with other overloads. PiperOrigin-RevId: 539079130 Change-Id: I5aea9dd9b8a1ce708c787df7d6c9a75ae419c484
This commit is contained in:
committed by
Copybara-Service
parent
66eae02ea7
commit
87ce390379
@@ -146,7 +146,13 @@ void AppendPieces(std::string* dest,
|
||||
|
||||
void StrAppend(std::string* dest, const AlphaNum& a) {
|
||||
ASSERT_NO_OVERLAP(*dest, a);
|
||||
dest->append(a.data(), a.size());
|
||||
std::string::size_type old_size = dest->size();
|
||||
strings_internal::STLStringResizeUninitializedAmortized(dest,
|
||||
old_size + a.size());
|
||||
char* const begin = &(*dest)[0];
|
||||
char* out = begin + old_size;
|
||||
out = Append(out, a);
|
||||
assert(out == begin + dest->size());
|
||||
}
|
||||
|
||||
void StrAppend(std::string* dest, const AlphaNum& a, const AlphaNum& b) {
|
||||
|
||||
Reference in New Issue
Block a user