diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2022-08-24 23:47:43 +0100 |
---|---|---|
committer | Jonathan Wakely <jwakely@redhat.com> | 2022-08-24 23:47:43 +0100 |
commit | e5428086c2c8daf69e5916dd5016d1e7b85d3f0d (patch) | |
tree | 742b284d4bdd61e7f40ce9d85b4615d9110d0045 | |
parent | f46f58e61db3b1e71beb21443c0ca9387bc836e2 (diff) | |
download | gcc-e5428086c2c8daf69e5916dd5016d1e7b85d3f0d.zip gcc-e5428086c2c8daf69e5916dd5016d1e7b85d3f0d.tar.gz gcc-e5428086c2c8daf69e5916dd5016d1e7b85d3f0d.tar.bz2 |
Revert "libstdc++: Optimize operator+(string/char*, char*/string) equally"
This reverts commit 0b7c9254998b3fb2c39f6b86b5b196f415530205.
-rw-r--r-- | libstdc++-v3/include/bits/basic_string.h | 9 | ||||
-rw-r--r-- | libstdc++-v3/include/bits/basic_string.tcc | 21 |
2 files changed, 7 insertions, 23 deletions
diff --git a/libstdc++-v3/include/bits/basic_string.h b/libstdc++-v3/include/bits/basic_string.h index fa67389..b04fba9 100644 --- a/libstdc++-v3/include/bits/basic_string.h +++ b/libstdc++-v3/include/bits/basic_string.h @@ -3521,9 +3521,14 @@ _GLIBCXX_END_NAMESPACE_CXX11 */ template<typename _CharT, typename _Traits, typename _Alloc> _GLIBCXX20_CONSTEXPR - basic_string<_CharT, _Traits, _Alloc> + inline basic_string<_CharT, _Traits, _Alloc> operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, - const _CharT* __rhs); + const _CharT* __rhs) + { + basic_string<_CharT, _Traits, _Alloc> __str(__lhs); + __str.append(__rhs); + return __str; + } /** * @brief Concatenate string and character. diff --git a/libstdc++-v3/include/bits/basic_string.tcc b/libstdc++-v3/include/bits/basic_string.tcc index 95ba8e5..4563c61 100644 --- a/libstdc++-v3/include/bits/basic_string.tcc +++ b/libstdc++-v3/include/bits/basic_string.tcc @@ -641,27 +641,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } template<typename _CharT, typename _Traits, typename _Alloc> - _GLIBCXX20_CONSTEXPR - basic_string<_CharT, _Traits, _Alloc> - operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, - const _CharT* __rhs) - { - __glibcxx_requires_string(__rhs); - typedef basic_string<_CharT, _Traits, _Alloc> __string_type; - typedef typename __string_type::size_type __size_type; - typedef typename __gnu_cxx::__alloc_traits<_Alloc>::template - rebind<_CharT>::other _Char_alloc_type; - typedef __gnu_cxx::__alloc_traits<_Char_alloc_type> _Alloc_traits; - const __size_type __len = _Traits::length(__rhs); - __string_type __str(_Alloc_traits::_S_select_on_copy( - __lhs.get_allocator())); - __str.reserve(__len + __lhs.size()); - __str.append(__lhs); - __str.append(__rhs, __len); - return __str; - } - - template<typename _CharT, typename _Traits, typename _Alloc> _GLIBCXX_STRING_CONSTEXPR typename basic_string<_CharT, _Traits, _Alloc>::size_type basic_string<_CharT, _Traits, _Alloc>:: |