stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Anton Pevtsov" <Ant...@moscow.vdiweb.com>
Subject RE: svn commit: r407120 - /incubator/stdcxx/trunk/include/vector.cc
Date Wed, 17 May 2006 13:11:24 GMT
Martin, after applying your changes I got the following warning on
Linux, gcc 4.0.2:

stdcxx/trunk/include/vector.cc: In member function 'void
std::vector<_TypeT, _Allocator>::_C_insert_range(typename
_Allocator::pointer, _FwdIter, _FwdIter, std::forward_iterator_tag)':
stdcxx/trunk/include/vector.cc:630: warning: declaration of '__end'
shadows a previous local
stdcxx/trunk/include/vector.cc:601: warning: shadowed declaration is
here

Is this correct? 


Thanks,
Anton Pevtsov

-----Original Message-----
From: sebor@apache.org [mailto:sebor@apache.org] 
Sent: Wednesday, May 17, 2006 05:29
To: stdcxx-commits@incubator.apache.org
Subject: svn commit: r407120 - /incubator/stdcxx/trunk/include/vector.cc


Author: sebor
Date: Tue May 16 18:28:38 2006
New Revision: 407120

URL: http://svn.apache.org/viewcvs?rev=407120&view=rev
Log:
2006-05-16  Martin Sebor  <sebor@roguewave.com>

	STDCXX-179
	* vector.cc (_C_insert_range): Corrected the persistent logic
	error in the computation of the end of the range of elements
	to be overwritten (assigned).

Modified:
    incubator/stdcxx/trunk/include/vector.cc

Modified: incubator/stdcxx/trunk/include/vector.cc
URL:
http://svn.apache.org/viewcvs/incubator/stdcxx/trunk/include/vector.cc?r
ev=407120&r1=407119&r2=407120&view=diff
========================================================================
======
--- incubator/stdcxx/trunk/include/vector.cc (original)
+++ incubator/stdcxx/trunk/include/vector.cc Tue May 16 18:28:38 2006
@@ -589,38 +589,35 @@
 
     if (__insert_in_place) {
 
-        // compute the beginning of the range of elements in the
sequence
-        // controlled by *this that need to be moved (copy contructed
past
-        // the end of the end of the sequence or assigned over existing
-        // elements)
+        // compute the beginning an end of the range of elements
+        // in the sequence controlled by *this that need to be moved
+        // (copy contructed past the end of the end of the sequence
+        // or assigned over existing elements)
         const pointer __movbeg = __self->_C_begin + __size1;
+        const pointer __movend = __movbeg + __size2;
+
         _RWSTD_ASSERT (__self->_C_make_iter (__movbeg) == __it);
 
-        if (__movbeg + __size2 <= __self->_C_end) {
+        const pointer __end = __self->_C_end;
+
+        if (__movend <= __end) {
 
             // compute the beginning of the range of elements whose
copies
-            // will be constructed just past the current end of the
sequence
-            pointer __ucpbeg = __self->_C_end - __size2;
+            // will be copy-constructed in the uninitialized space just
past
+            // the current end of the sequence
+            const pointer __ucpbeg = __end - __size2;
 
             // construct copies of elements that will be moved beyond
-            // the current end of the sequence controlled by *this as
-            // if by calling
-            // std::uninitialized_copy (__ucpbeg, _C_end, _C_end);
-            pointer __end = __self->_C_end;
-
+            // the current end of the sequence controlled by *this
             pointer __p;
 
             for (__p = __ucpbeg; !(__p == __end); ++__p,
++__self->_C_end)
                 __self->_C_construct (__self->_C_end, *__p);
 
             // copy elements that will be overwritten below
-            // over the range of elements moved above as if
-            // by a call to
-            // std::copy_backward (__movbeg, __ucpbeg, __movbeg);
-
-            for (__p = __ucpbeg; !(__p == __movbeg); ) {
-                *__ucpbeg-- = *--__p;
-            }
+            // over the range of elements moved above
+            for (__p = __end; __movend < __p--; )
+                *__p = *(__p - __size2);
         }
         else {
             // compute the length of the initial subsequence of the
range



Mime
View raw message