diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2020-10-14 12:10:26 +0100 |
---|---|---|
committer | Jonathan Wakely <jwakely@redhat.com> | 2020-10-14 12:52:47 +0100 |
commit | 252c9967ba785aedf3b39e2cd50237d0f32fe3bd (patch) | |
tree | 4339807dd324b6445d5a8195715e3a575784ad06 /libstdc++-v3/include/bits/basic_string.tcc | |
parent | a1b6b013615082f0837ea34c5a65136822523be7 (diff) | |
download | gcc-252c9967ba785aedf3b39e2cd50237d0f32fe3bd.tar.gz |
libstdc++: Define some std::string constructors inline
There are a lot of very simple constructors for the old string which are
not defined inline. I don't see any reason for this and it probably
makes them less likely to be optimized away. Move the definitions into
the class body.
libstdc++-v3/ChangeLog:
* include/bits/basic_string.h (basic_string(const Alloc&))
(basic_string(const basic_string&)
(basic_string(const CharT*, size_type, const Alloc&))
(basic_string(const CharT*, const Alloc&))
(basic_string(size_type, CharT, const Alloc&))
(basic_string(initializer_list<CharT>, const Alloc&))
(basic_string(InputIterator, InputIterator, const Alloc&)):
Define inline in class body.
* include/bits/basic_string.tcc (basic_string(const Alloc&))
(basic_string(const basic_string&)
(basic_string(const CharT*, size_type, const Alloc&))
(basic_string(const CharT*, const Alloc&))
(basic_string(size_type, CharT, const Alloc&))
(basic_string(initializer_list<CharT>, const Alloc&))
(basic_string(InputIterator, InputIterator, const Alloc&)):
Move definitions into class body.
Diffstat (limited to 'libstdc++-v3/include/bits/basic_string.tcc')
-rw-r--r-- | libstdc++-v3/include/bits/basic_string.tcc | 51 |
1 files changed, 0 insertions, 51 deletions
diff --git a/libstdc++-v3/include/bits/basic_string.tcc b/libstdc++-v3/include/bits/basic_string.tcc index 95d2fdbd6d6..6c789665160 100644 --- a/libstdc++-v3/include/bits/basic_string.tcc +++ b/libstdc++-v3/include/bits/basic_string.tcc @@ -634,20 +634,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template<typename _CharT, typename _Traits, typename _Alloc> basic_string<_CharT, _Traits, _Alloc>:: - basic_string(const basic_string& __str) - : _M_dataplus(__str._M_rep()->_M_grab(_Alloc(__str.get_allocator()), - __str.get_allocator()), - __str.get_allocator()) - { } - - template<typename _CharT, typename _Traits, typename _Alloc> - basic_string<_CharT, _Traits, _Alloc>:: - basic_string(const _Alloc& __a) - : _M_dataplus(_S_construct(size_type(), _CharT(), __a), __a) - { } - - template<typename _CharT, typename _Traits, typename _Alloc> - basic_string<_CharT, _Traits, _Alloc>:: basic_string(const basic_string& __str, size_type __pos, const _Alloc& __a) : _M_dataplus(_S_construct(__str._M_data() + __str._M_check(__pos, @@ -677,43 +663,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION + __pos, __a), __a) { } - // TBD: DPG annotate - template<typename _CharT, typename _Traits, typename _Alloc> - basic_string<_CharT, _Traits, _Alloc>:: - basic_string(const _CharT* __s, size_type __n, const _Alloc& __a) - : _M_dataplus(_S_construct(__s, __s + __n, __a), __a) - { } - - // TBD: DPG annotate - template<typename _CharT, typename _Traits, typename _Alloc> - basic_string<_CharT, _Traits, _Alloc>:: - basic_string(const _CharT* __s, const _Alloc& __a) - : _M_dataplus(_S_construct(__s, __s ? __s + traits_type::length(__s) : - __s + npos, __a), __a) - { } - - template<typename _CharT, typename _Traits, typename _Alloc> - basic_string<_CharT, _Traits, _Alloc>:: - basic_string(size_type __n, _CharT __c, const _Alloc& __a) - : _M_dataplus(_S_construct(__n, __c, __a), __a) - { } - - // TBD: DPG annotate - template<typename _CharT, typename _Traits, typename _Alloc> - template<typename _InputIterator> - basic_string<_CharT, _Traits, _Alloc>:: - basic_string(_InputIterator __beg, _InputIterator __end, const _Alloc& __a) - : _M_dataplus(_S_construct(__beg, __end, __a), __a) - { } - -#if __cplusplus >= 201103L - template<typename _CharT, typename _Traits, typename _Alloc> - basic_string<_CharT, _Traits, _Alloc>:: - basic_string(initializer_list<_CharT> __l, const _Alloc& __a) - : _M_dataplus(_S_construct(__l.begin(), __l.end(), __a), __a) - { } -#endif - template<typename _CharT, typename _Traits, typename _Alloc> basic_string<_CharT, _Traits, _Alloc>& basic_string<_CharT, _Traits, _Alloc>:: |