diff options
author | Paolo Carlini <pcarlini@suse.de> | 2006-01-03 22:05:32 +0000 |
---|---|---|
committer | Paolo Carlini <pcarlini@suse.de> | 2006-01-03 22:05:32 +0000 |
commit | 4697e63234c72f3e870dc88db4943707a090c55d (patch) | |
tree | 1cee66ae067553a369928a24f0a71000141ffd6b | |
parent | ff2238029621eb634b96fd7df7a5617beb347acb (diff) |
2006-01-03 Paolo Carlini <pcarlini@suse.de>
* include/ext/sso_string.h (__sso_string<>::_M_dataplus):
Use _CharT_alloc_type as base class.
(_M_get_allocator, _M_swap, _M_create, _M_destroy): Adjust.
* include/bits/basic_string.h (get_allocator): Tidy.
git-svn-id: https://gcc.gnu.org/svn/gcc/branches/libstdcxx_so_7-branch@109289 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | libstdc++-v3/ChangeLog.libstdcxx_so_7-branch | 7 | ||||
-rw-r--r-- | libstdc++-v3/include/bits/basic_string.h | 2 | ||||
-rw-r--r-- | libstdc++-v3/include/ext/sso_string.h | 16 |
3 files changed, 16 insertions, 9 deletions
diff --git a/libstdc++-v3/ChangeLog.libstdcxx_so_7-branch b/libstdc++-v3/ChangeLog.libstdcxx_so_7-branch index dd6de5c39b4..1c66cf2c676 100644 --- a/libstdc++-v3/ChangeLog.libstdcxx_so_7-branch +++ b/libstdc++-v3/ChangeLog.libstdcxx_so_7-branch @@ -1,3 +1,10 @@ +2006-01-03 Paolo Carlini <pcarlini@suse.de> + + * include/ext/sso_string.h (__sso_string<>::_M_dataplus): + Use _CharT_alloc_type as base class. + (_M_get_allocator, _M_swap, _M_create, _M_destroy): Adjust. + * include/bits/basic_string.h (get_allocator): Tidy. + 2005-12-23 Paolo Carlini <pcarlini@suse.de> * include/bits/stl_bvector.h (vector<bool>::erase(iterator, diff --git a/libstdc++-v3/include/bits/basic_string.h b/libstdc++-v3/include/bits/basic_string.h index ea5672325ed..cb317b06781 100644 --- a/libstdc++-v3/include/bits/basic_string.h +++ b/libstdc++-v3/include/bits/basic_string.h @@ -1313,7 +1313,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) */ allocator_type get_allocator() const - { return this->_M_get_allocator(); } + { return allocator_type(this->_M_get_allocator()); } /** * @brief Find position of a C substring. diff --git a/libstdc++-v3/include/ext/sso_string.h b/libstdc++-v3/include/ext/sso_string.h index 92fb6d28dc4..9a86b54fd64 100644 --- a/libstdc++-v3/include/ext/sso_string.h +++ b/libstdc++-v3/include/ext/sso_string.h @@ -45,7 +45,6 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) public: typedef _Traits traits_type; typedef typename _Traits::char_type value_type; - typedef _Alloc allocator_type; typedef __string_utility<_CharT, _Traits, _Alloc> _Util_Base; typedef typename _Util_Base::_CharT_alloc_type _CharT_alloc_type; @@ -67,7 +66,8 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) / sizeof(_CharT)) - 1) / 4 }; // Data Members (private): - typename _Util_Base::template _Alloc_hider<_Alloc> _M_dataplus; + typename _Util_Base::template _Alloc_hider<_CharT_alloc_type> + _M_dataplus; size_type _M_string_length; enum { _S_local_capacity = 15 }; @@ -202,11 +202,11 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) ~__sso_string() { _M_dispose(); } - allocator_type& + _CharT_alloc_type& _M_get_allocator() { return _M_dataplus; } - const allocator_type& + const _CharT_alloc_type& _M_get_allocator() const { return _M_dataplus; } @@ -235,7 +235,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) void __sso_string<_CharT, _Traits, _Alloc>:: _M_destroy(size_type __size) throw() - { _CharT_alloc_type(_M_get_allocator()).deallocate(_M_data(), __size + 1); } + { _M_dataplus._CharT_alloc_type::deallocate(_M_data(), __size + 1); } template<typename _CharT, typename _Traits, typename _Alloc> void @@ -244,8 +244,8 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) { // _GLIBCXX_RESOLVE_LIB_DEFECTS // 431. Swapping containers with unequal allocators. - std::__alloc_swap<allocator_type>::_S_do_it(_M_get_allocator(), - __rcs._M_get_allocator()); + std::__alloc_swap<_CharT_alloc_type>::_S_do_it(_M_get_allocator(), + __rcs._M_get_allocator()); if (_M_is_local()) if (__rcs._M_is_local()) @@ -329,7 +329,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) // NB: Need an array of char_type[__capacity], plus a terminating // null char_type() element. - return _CharT_alloc_type(_M_get_allocator()).allocate(__capacity + 1); + return _M_dataplus._CharT_alloc_type::allocate(__capacity + 1); } template<typename _CharT, typename _Traits, typename _Alloc> |