From 03284a7d592a4cb93b3a9b6cb1e43c3427993dc9 Mon Sep 17 00:00:00 2001 From: paolo Date: Sun, 6 Aug 2006 14:45:04 +0000 Subject: [PATCH] 2006-08-06 Paolo Carlini PR libstdc++/16611 * include/bits/stl_bvector.h (vector::operator[], vector::operator[] const): Do not use iterator::operator+, hand code. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@115972 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 7 +++++++ libstdc++-v3/include/bits/stl_bvector.h | 10 ++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 1d87705120b..7983c7eb3fd 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,10 @@ +2006-08-06 Paolo Carlini + + PR libstdc++/16611 + * include/bits/stl_bvector.h (vector::operator[], + vector::operator[] const): Do not use iterator::operator+, + hand code. + 2006-08-05 Paolo Carlini PR libstdc++/28587 diff --git a/libstdc++-v3/include/bits/stl_bvector.h b/libstdc++-v3/include/bits/stl_bvector.h index 02aa44cd0f0..72982a82ec5 100644 --- a/libstdc++-v3/include/bits/stl_bvector.h +++ b/libstdc++-v3/include/bits/stl_bvector.h @@ -575,11 +575,17 @@ template reference operator[](size_type __n) - { return *(begin() + difference_type(__n)); } + { + return *iterator(this->_M_impl._M_start._M_p + + __n / int(_S_word_bit), __n % int(_S_word_bit)); + } const_reference operator[](size_type __n) const - { return *(begin() + difference_type(__n)); } + { + return *const_iterator(this->_M_impl._M_start._M_p + + __n / int(_S_word_bit), __n % int(_S_word_bit)); + } protected: void -- 2.11.0