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] Minor tweak to fill(_Bit_iterator)


Hi,

just avoid a subtle dependency on an implementation detail of algobase. Tested x86-linux, committed.

Paolo.

//////////////////
2006-08-11  Paolo Carlini  <pcarlini@suse.de>

	* include/bits/stl_bvector.h (__fill_bvector(_Bit_iterator,
	_Bit_iterator, bool)): New.
	(fill(_Bit_iterator, _Bit_iterator, const bool&)): Use it.
Index: include/bits/stl_bvector.h
===================================================================
--- include/bits/stl_bvector.h	(revision 116059)
+++ include/bits/stl_bvector.h	(working copy)
@@ -354,17 +354,23 @@
   { return __x + __n; }
 
   inline void
+  __fill_bvector(_Bit_iterator __first, _Bit_iterator __last, bool __x)
+  {
+    for (; __first != __last; ++__first)
+      *__first = __x;
+  }
+
+  inline void
   fill(_Bit_iterator __first, _Bit_iterator __last, const bool& __x)
   {
     if (__first._M_p != __last._M_p)
       {
-	std::__fill<true>::fill(__first._M_p + 1, __last._M_p, __x ? ~0 : 0);
-	std::__fill<true>::fill(__first, _Bit_iterator(__first._M_p + 1, 0),
-				__x);
-	std::__fill<true>::fill(_Bit_iterator(__last._M_p, 0), __last, __x);
+	std::fill(__first._M_p + 1, __last._M_p, __x ? ~0 : 0);
+	__fill_bvector(__first, _Bit_iterator(__first._M_p + 1, 0), __x);
+	__fill_bvector(_Bit_iterator(__last._M_p, 0), __last, __x);
       }
     else
-      std::__fill<true>::fill(__first, __last, __x);
+      __fill_bvector(__first, __last, __x);
   }
 
   template<class _Alloc>

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