summaryrefslogtreecommitdiff
path: root/libstdc++-v3/include/debug
diff options
context:
space:
mode:
authorfdumont <fdumont@138bc75d-0d04-0410-961f-82ee72b054a4>2012-02-06 20:19:44 +0000
committerfdumont <fdumont@138bc75d-0d04-0410-961f-82ee72b054a4>2012-02-06 20:19:44 +0000
commit70102d084e01d9e1e73bafbaba211d426798c526 (patch)
tree0088c6eec6bede2a2e18376a5815c02d951c71f5 /libstdc++-v3/include/debug
parentda7eaa223a56d51c082e3ceeede801f3eb03ef83 (diff)
downloadgcc-70102d084e01d9e1e73bafbaba211d426798c526.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@183941 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/include/debug')
-rw-r--r--libstdc++-v3/include/debug/safe_iterator.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/libstdc++-v3/include/debug/safe_iterator.h b/libstdc++-v3/include/debug/safe_iterator.h
index 016ec7b9418..e7cfe9c9d53 100644
--- a/libstdc++-v3/include/debug/safe_iterator.h
+++ b/libstdc++-v3/include/debug/safe_iterator.h
@@ -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?