From: Paolo Carlini Date: Thu, 15 Dec 2005 11:31:59 +0000 (+0000) Subject: stl_vector.h (vector<>::_M_get_Tp_allocator): Change to return by ref and add non... X-Git-Tag: releases/gcc-4.2.0~5340 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8d46ce6095853cebc4ea306fe0d00a4aa9758610;p=thirdparty%2Fgcc.git stl_vector.h (vector<>::_M_get_Tp_allocator): Change to return by ref and add non const version. 2005-12-15 Paolo Carlini * include/bits/stl_vector.h (vector<>::_M_get_Tp_allocator): Change to return by ref and add non const version. * include/bits/stl_deque.h (deque<>::_M_get_Tp_allocator): Likewise. From-SVN: r108570 --- diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 5197f12c3ef3..92540fba329c 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,9 @@ +2005-12-15 Paolo Carlini + + * include/bits/stl_vector.h (vector<>::_M_get_Tp_allocator): Change + to return by ref and add non const version. + * include/bits/stl_deque.h (deque<>::_M_get_Tp_allocator): Likewise. + 2005-12-15 Paolo Carlini PR libstdc++/25421 diff --git a/libstdc++-v3/include/bits/stl_deque.h b/libstdc++-v3/include/bits/stl_deque.h index e5f5beb43f93..eb534ca8c940 100644 --- a/libstdc++-v3/include/bits/stl_deque.h +++ b/libstdc++-v3/include/bits/stl_deque.h @@ -395,7 +395,11 @@ namespace _GLIBCXX_STD { } }; - _Tp_alloc_type + _Tp_alloc_type& + _M_get_Tp_allocator() + { return *static_cast<_Tp_alloc_type*>(&this->_M_impl); } + + const _Tp_alloc_type& _M_get_Tp_allocator() const { return *static_cast(&this->_M_impl); } diff --git a/libstdc++-v3/include/bits/stl_vector.h b/libstdc++-v3/include/bits/stl_vector.h index 7d8519cdfdd4..d8ea4b37047f 100644 --- a/libstdc++-v3/include/bits/stl_vector.h +++ b/libstdc++-v3/include/bits/stl_vector.h @@ -91,7 +91,11 @@ namespace _GLIBCXX_STD public: typedef _Alloc allocator_type; - _Tp_alloc_type + _Tp_alloc_type& + _M_get_Tp_allocator() + { return *static_cast<_Tp_alloc_type*>(&this->_M_impl); } + + const _Tp_alloc_type& _M_get_Tp_allocator() const { return *static_cast(&this->_M_impl); }