summaryrefslogtreecommitdiff
path: root/boost/coroutine2/detail/pull_coroutine.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'boost/coroutine2/detail/pull_coroutine.hpp')
-rw-r--r--boost/coroutine2/detail/pull_coroutine.hpp33
1 files changed, 21 insertions, 12 deletions
diff --git a/boost/coroutine2/detail/pull_coroutine.hpp b/boost/coroutine2/detail/pull_coroutine.hpp
index 32cd68eb70..c8ea49f367 100644
--- a/boost/coroutine2/detail/pull_coroutine.hpp
+++ b/boost/coroutine2/detail/pull_coroutine.hpp
@@ -56,8 +56,7 @@ public:
pull_coroutine & operator=( pull_coroutine && other) noexcept {
if ( this == & other) return * this;
- cb_ = other.cb_;
- other.cb_ = nullptr;
+ std::swap( cb_, other.cb_);
return * this;
}
@@ -69,7 +68,7 @@ public:
T get() noexcept;
- class iterator : public std::iterator< std::input_iterator_tag, typename std::remove_reference< T >::type > {
+ class iterator {
private:
pull_coroutine< T > * c_{ nullptr };
@@ -89,8 +88,14 @@ public:
}
public:
- typedef typename iterator::pointer pointer_t;
- typedef typename iterator::reference reference_t;
+ typedef std::input_iterator_tag iterator_category;
+ typedef typename std::remove_reference< T >::type value_type;
+ typedef std::ptrdiff_t difference_type;
+ typedef value_type * pointer;
+ typedef value_type & reference;
+
+ typedef pointer pointer_t;
+ typedef reference reference_t;
iterator() noexcept = default;
@@ -168,8 +173,7 @@ public:
pull_coroutine & operator=( pull_coroutine && other) noexcept {
if ( this == & other) return * this;
- cb_ = other.cb_;
- other.cb_ = nullptr;
+ std::swap( cb_, other.cb_);
return * this;
}
@@ -181,7 +185,7 @@ public:
T & get() noexcept;
- class iterator : public std::iterator< std::input_iterator_tag, typename std::remove_reference< T >::type > {
+ class iterator {
private:
pull_coroutine< T & > * c_{ nullptr };
@@ -201,8 +205,14 @@ public:
}
public:
- typedef typename iterator::pointer pointer_t;
- typedef typename iterator::reference reference_t;
+ typedef std::input_iterator_tag iterator_category;
+ typedef typename std::remove_reference< T >::type value_type;
+ typedef std::ptrdiff_t difference_type;
+ typedef value_type * pointer;
+ typedef value_type & reference;
+
+ typedef pointer pointer_t;
+ typedef reference reference_t;
iterator() noexcept = default;
@@ -278,8 +288,7 @@ public:
pull_coroutine & operator=( pull_coroutine && other) noexcept {
if ( this == & other) return * this;
- cb_ = other.cb_;
- other.cb_ = nullptr;
+ std::swap( cb_, other.cb_);
return * this;
}