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] Remove unused <vector> function


Hi,

funny, I was studying the reallocation strategy (vs that of <string>),
and noticed this.

Perhaps, once was used by the non-standard default-value insert, but
more recently, the latter (removed for 3.3), just called the standard
insert. So, *real* junk! ;)

Tested x86-linux, committing to mainline (3.4 too, soon, I guess)

Paolo.

///////////
2004-02-01  Paolo Carlini  <pcarlini@suse.de>

	* include/bits/vector.tcc (vector::_M_insert_aux(iterator)):
	Remove, unused.
diff -urN libstdc++-v3-orig/include/bits/vector.tcc libstdc++-v3/include/bits/vector.tcc
--- libstdc++-v3-orig/include/bits/vector.tcc	2004-01-27 01:49:02.000000000 +0100
+++ libstdc++-v3/include/bits/vector.tcc	2004-02-01 22:40:38.000000000 +0100
@@ -268,51 +268,7 @@
         this->_M_end_of_storage = __new_start.base() + __len;
       }
     }
-  
-  #ifdef _GLIBCXX_DEPRECATED
-  template<typename _Tp, typename _Alloc>
-    void
-    vector<_Tp,_Alloc>::
-    _M_insert_aux(iterator __position)
-    {
-      if (_M_finish != _M_end_of_storage)
-      {
-        std::_Construct(_M_finish, *(_M_finish - 1));
-        ++_M_finish;
-        std::copy_backward(__position, iterator(_M_finish - 2),
-			   iterator(_M_finish - 1));
-        *__position = value_type();
-      }
-      else
-      {
-        const size_type __old_size = size();
-        const size_type __len = __old_size != 0 ? 2 * __old_size : 1;
-        pointer __new_start = _M_allocate(__len);
-        pointer __new_finish = __new_start;
-        try
-          {
-            __new_finish = std::uninitialized_copy(iterator(_M_start), __position,
-						   __new_start);
-            std::_Construct(__new_finish);
-            ++__new_finish;
-            __new_finish = std::uninitialized_copy(__position, iterator(_M_finish),
-						   __new_finish);
-          }
-        catch(...)
-          {
-            std::_Destroy(__new_start,__new_finish);
-            _M_deallocate(__new_start,__len);
-            __throw_exception_again;
-          }
-        std::_Destroy(begin(), end());
-        _M_deallocate(_M_start, _M_end_of_storage - _M_start);
-        _M_start = __new_start;
-        _M_finish = __new_finish;
-        _M_end_of_storage = __new_start + __len;
-      }
-    }
-  #endif
-  
+
   template<typename _Tp, typename _Alloc>
     void
     vector<_Tp,_Alloc>::

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