[patch] libstdc++/56166 avoid allocation in basic_string::clear()
Jonathan Wakely
jwakely@redhat.com
Tue Jun 3 21:33:00 GMT 2014
Instead of cloning the string and then setting its length to zero,
just point to the empty rep instead.
I'm not sure if this is conforming in C++03, because it modifies the
capacity(), whereas clear() is specified as if it called
erase(begin(), end()), which typically wouldn't alter the capacity
(but I'm not sure whether it's allowed to alter it).
It passes all tests, but I'm not planning to commit it.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.txt
Type: text/x-patch
Size: 6923 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20140603/d29b8037/attachment.bin>
More information about the Libstdc++
mailing list