]> gcc.gnu.org Git - gcc.git/commitdiff
2012-02-06 François Dumont <fdumont@gcc.gnu.org>
authorFrançois Dumont <fdumont@gcc.gnu.org>
Mon, 6 Feb 2012 20:19:44 +0000 (20:19 +0000)
committerFrançois Dumont <fdumont@gcc.gnu.org>
Mon, 6 Feb 2012 20:19:44 +0000 (20:19 +0000)
* include/debug/safe_iterator.h
(_Safe_iterator::_M_before_dereferenceable): Avoid the expensive
creation of a _Safe_iterator instance to do the check.

From-SVN: r183941

libstdc++-v3/ChangeLog
libstdc++-v3/include/debug/safe_iterator.h

index 799be7c5d4e5c2d5f7d10feed29cfe8e27fe6b3e..95a9a181935f61cac84afc0528ff344059adbf97 100644 (file)
@@ -1,3 +1,9 @@
+2012-02-06  François Dumont  <fdumont@gcc.gnu.org>
+
+       * include/debug/safe_iterator.h
+       (_Safe_iterator::_M_before_dereferenceable): Avoid the expensive
+       creation of a _Safe_iterator instance to do the check.
+
 2012-02-05  Jonathan Wakely  <jwakely.gcc@gmail.com>
 
        PR libstdc++/52104
index 016ec7b9418ca52f1cecaf7ca8a3594b21edd20e..e7cfe9c9d53b8564cee49fac52cbf0059ba7a236 100644 (file)
@@ -380,8 +380,12 @@ namespace __gnu_debug
       bool
       _M_before_dereferenceable() const
       {
-       _Self __it = *this;
-       return __it._M_incrementable() && (++__it)._M_dereferenceable();
+       if (this->_M_incrementable())
+       {
+         _Iterator __base = base();
+         return ++__base != _M_get_sequence()->_M_base().end();
+       }
+       return false;
       }
 
       /// Is the iterator incrementable?
This page took 0.059194 seconds and 5 git commands to generate.