Avoid reallocation for basic_string::clear()
authorJonathan Wakely <jwakely@redhat.com>
Fri, 23 Sep 2016 17:25:34 +0000 (18:25 +0100)
committerJonathan Wakely <redi@gcc.gnu.org>
Fri, 23 Sep 2016 17:25:34 +0000 (18:25 +0100)
commit13190419240ac47394feb896e0ff5f33e9f28906
tree56614f636249d7a44d3995a94376be8ae7c06f05
parenta922c5ff6f3872fc9ce1e484a0e92f288ff6c68d
Avoid reallocation for basic_string::clear()

PR libstdc++/56166
PR libstdc++/77582
* include/bits/basic_string.h (basic_string::clear()): Drop reference
and use empty rep.
* include/ext/rc_string_base.h (__rc_string_base::_M_clear()):
Likewise.
* testsuite/21_strings/basic_string/56166.cc: New.
* testsuite/ext/vstring/modifiers/clear/56166.cc: New.

From-SVN: r240447
libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/basic_string.h
libstdc++-v3/include/ext/rc_string_base.h
libstdc++-v3/testsuite/21_strings/basic_string/56166.cc [new file with mode: 0644]
libstdc++-v3/testsuite/ext/vstring/modifiers/clear/56166.cc [new file with mode: 0644]