This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[v3] libstdc++/16611


Hi,

tested x86-linux, committed to mainline.

Paolo.

////////////////
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.
Index: include/bits/stl_bvector.h
===================================================================
--- include/bits/stl_bvector.h	(revision 115971)
+++ include/bits/stl_bvector.h	(working copy)
@@ -575,11 +575,17 @@
 
     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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]