We reset safe iterator state a lot, quite annoying when debugging.

Comitted as trivial.

2018-06-07  François Dumont  <fdum...@gcc.gnu.org>

    * src/c++11/debug.cc
    (_Safe_iterator_base::_M_detach()): Reset state only if needed.
    (_Safe_iterator_base::_M_detach_single()): Likewise.
    (_Safe_local_iterator_base::_M_detach()): Reset state only if needed.
    (_Safe_local_iterator_base::_M_detach_single()): Likewise.

diff --git a/libstdc++-v3/src/c++11/debug.cc b/libstdc++-v3/src/c++11/debug.cc
index d20725c..f7249a3 100644
--- a/libstdc++-v3/src/c++11/debug.cc
+++ b/libstdc++-v3/src/c++11/debug.cc
@@ -379,9 +379,10 @@ namespace __gnu_debug
   _M_detach()
   {
     if (_M_sequence)
-      _M_sequence->_M_detach(this);
-
-    _M_reset();
+      {
+	_M_sequence->_M_detach(this);
+	_M_reset();
+      }
   }
 
   void
@@ -389,9 +390,10 @@ namespace __gnu_debug
   _M_detach_single() throw ()
   {
     if (_M_sequence)
-      _M_sequence->_M_detach_single(this);
-
-    _M_reset();
+      {
+	_M_sequence->_M_detach_single(this);
+	_M_reset();
+      }
   }
 
   void
@@ -462,9 +464,10 @@ namespace __gnu_debug
   _M_detach()
   {
     if (_M_sequence)
-      _M_get_container()->_M_detach_local(this);
-
-    _M_reset();
+      {
+	_M_get_container()->_M_detach_local(this);
+	_M_reset();
+      }
   }
 
   void
@@ -472,9 +475,10 @@ namespace __gnu_debug
   _M_detach_single() throw ()
   {
     if (_M_sequence)
-      _M_get_container()->_M_detach_local_single(this);
-
-    _M_reset();
+      {
+	_M_get_container()->_M_detach_local_single(this);
+	_M_reset();
+      }
   }
 
   void

Reply via email to