summaryrefslogtreecommitdiff
path: root/libstdc++-v3/include/debug
diff options
context:
space:
mode:
authorredi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>2012-03-04 12:49:22 +0000
committerredi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>2012-03-04 12:49:22 +0000
commitd111cd78f36fd2d549b9dbbdd3a5b51e664de1af (patch)
tree12154c48b478dd2fb2d1d70c4db03a56eb7f12f5 /libstdc++-v3/include/debug
parent0989c0ee3172d6de95579609ba0cb092342f1a9c (diff)
downloadgcc-d111cd78f36fd2d549b9dbbdd3a5b51e664de1af.tar.gz
PR libstdc++/52433
* include/debug/safe_iterator.h (_Safe_iterator): Add move constructor and move assignment operator. * testsuite/23_containers/vector/debug/52433.cc: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@184880 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/include/debug')
-rw-r--r--libstdc++-v3/include/debug/safe_iterator.h33
1 files changed, 32 insertions, 1 deletions
diff --git a/libstdc++-v3/include/debug/safe_iterator.h b/libstdc++-v3/include/debug/safe_iterator.h
index e7cfe9c9d53..65dff556317 100644
--- a/libstdc++-v3/include/debug/safe_iterator.h
+++ b/libstdc++-v3/include/debug/safe_iterator.h
@@ -169,6 +169,19 @@ namespace __gnu_debug
._M_iterator(__x, "other"));
}
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /**
+ * @brief Move construction.
+ * @post __x is singular and unattached
+ */
+ _Safe_iterator(_Safe_iterator&& __x) : _M_current()
+ {
+ std::swap(_M_current, __x._M_current);
+ this->_M_attach(__x._M_sequence);
+ __x._M_detach();
+ }
+#endif
+
/**
* @brief Converting constructor from a mutable iterator to a
* constant iterator.
@@ -208,6 +221,22 @@ namespace __gnu_debug
return *this;
}
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ /**
+ * @brief Move assignment.
+ * @post __x is singular and unattached
+ */
+ _Safe_iterator&
+ operator=(_Safe_iterator&& __x)
+ {
+ _M_current = __x._M_current;
+ _M_attach(__x._M_sequence);
+ __x._M_detach();
+ __x._M_current = _Iterator();
+ return *this;
+ }
+#endif
+
/**
* @brief Iterator dereference.
* @pre iterator is dereferenceable
@@ -422,7 +451,9 @@ namespace __gnu_debug
/// Is this iterator equal to the sequence's before_begin() iterator if
/// any?
bool _M_is_before_begin() const
- { return _BeforeBeginHelper<_Sequence>::_M_Is(base(), _M_get_sequence()); }
+ {
+ return _BeforeBeginHelper<_Sequence>::_M_Is(base(), _M_get_sequence());
+ }
};
template<typename _IteratorL, typename _IteratorR, typename _Sequence>