OSDN Git Service

2006-08-06 Paolo Carlini <pcarlini@suse.de>
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 6 Aug 2006 14:45:04 +0000 (14:45 +0000)
committerpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 6 Aug 2006 14:45:04 +0000 (14:45 +0000)
PR libstdc++/16611
* include/bits/stl_bvector.h (vector<bool>::operator[],
vector<bool>::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
libstdc++-v3/include/bits/stl_bvector.h

index 1d87705..7983c7e 100644 (file)
@@ -1,3 +1,10 @@
+2006-08-06  Paolo Carlini  <pcarlini@suse.de>
+
+       PR libstdc++/16611
+       * include/bits/stl_bvector.h (vector<bool>::operator[],
+       vector<bool>::operator[] const): Do not use iterator::operator+,
+       hand code.
+
 2006-08-05  Paolo Carlini  <pcarlini@suse.de>
 
        PR libstdc++/28587
index 02aa44c..72982a8 100644 (file)
@@ -575,11 +575,17 @@ template<typename _Alloc>
 
     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