diff options
Diffstat (limited to 'boost/coroutine2/detail/push_coroutine.hpp')
-rw-r--r-- | boost/coroutine2/detail/push_coroutine.hpp | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/boost/coroutine2/detail/push_coroutine.hpp b/boost/coroutine2/detail/push_coroutine.hpp index d152be2cde..4b5ba5c25d 100644 --- a/boost/coroutine2/detail/push_coroutine.hpp +++ b/boost/coroutine2/detail/push_coroutine.hpp @@ -54,8 +54,7 @@ public: push_coroutine & operator=( push_coroutine && other) noexcept { if ( this == & other) return * this; - cb_ = other.cb_; - other.cb_ = nullptr; + std::swap( cb_, other.cb_); return * this; } @@ -67,11 +66,17 @@ public: bool operator!() const noexcept; - class iterator : public std::iterator< std::output_iterator_tag, void, void, void, void > { + class iterator { private: push_coroutine< T > * c_{ nullptr }; public: + typedef std::output_iterator_tag iterator_category; + typedef void value_type; + typedef void difference_type; + typedef void pointer; + typedef void reference; + iterator() noexcept = default; explicit iterator( push_coroutine< T > * c) noexcept : @@ -134,8 +139,7 @@ public: push_coroutine & operator=( push_coroutine && other) noexcept { if ( this == & other) return * this; - cb_ = other.cb_; - other.cb_ = nullptr; + std::swap( cb_, other.cb_); return * this; } @@ -145,11 +149,17 @@ public: bool operator!() const noexcept; - class iterator : public std::iterator< std::output_iterator_tag, void, void, void, void > { + class iterator { private: push_coroutine< T & > * c_{ nullptr }; public: + typedef std::output_iterator_tag iterator_category; + typedef void value_type; + typedef void difference_type; + typedef void pointer; + typedef void reference; + iterator() noexcept = default; explicit iterator( push_coroutine< T & > * c) noexcept : @@ -212,8 +222,7 @@ public: push_coroutine & operator=( push_coroutine && other) noexcept { if ( this == & other) return * this; - cb_ = other.cb_; - other.cb_ = nullptr; + std::swap( cb_, other.cb_); return * this; } |