diff --git a/include/boost/coroutine2/detail/pull_coroutine.ipp b/include/boost/coroutine2/detail/pull_coroutine.ipp index 699d5ab..6a2f6ed 100644 --- a/include/boost/coroutine2/detail/pull_coroutine.ipp +++ b/include/boost/coroutine2/detail/pull_coroutine.ipp @@ -67,8 +67,8 @@ pull_coroutine< T >::~pull_coroutine() { template< typename T > pull_coroutine< T >::pull_coroutine( pull_coroutine && other) noexcept : - cb_{ other.cb_ } { - other.cb_ = nullptr; + cb_{ nullptr } { + std::swap( cb_, other.cb_); } template< typename T > @@ -136,8 +136,8 @@ pull_coroutine< T & >::~pull_coroutine() { template< typename T > pull_coroutine< T & >::pull_coroutine( pull_coroutine && other) noexcept : - cb_{ other.cb_ } { - other.cb_ = nullptr; + cb_{ nullptr } { + std::swap( cb_, other.cb_); } template< typename T > @@ -197,8 +197,8 @@ pull_coroutine< void >::~pull_coroutine() { inline pull_coroutine< void >::pull_coroutine( pull_coroutine && other) noexcept : - cb_{ other.cb_ } { - other.cb_ = nullptr; + cb_{ nullptr } { + std::swap( cb_, other.cb_); } inline diff --git a/include/boost/coroutine2/detail/push_coroutine.ipp b/include/boost/coroutine2/detail/push_coroutine.ipp index dd51403..dedfa42 100644 --- a/include/boost/coroutine2/detail/push_coroutine.ipp +++ b/include/boost/coroutine2/detail/push_coroutine.ipp @@ -56,8 +56,8 @@ push_coroutine< T >::~push_coroutine() { template< typename T > push_coroutine< T >::push_coroutine( push_coroutine && other) noexcept : - cb_{ other.cb_ } { - other.cb_ = nullptr; + cb_{ nullptr } { + std::swap( cb_, other.cb_); } template< typename T > @@ -116,8 +116,8 @@ push_coroutine< T & >::~push_coroutine() { template< typename T > push_coroutine< T & >::push_coroutine( push_coroutine && other) noexcept : - cb_{ other.cb_ } { - other.cb_ = nullptr; + cb_{ nullptr } { + std::swap( cb_, other.cb_); } template< typename T > @@ -167,8 +167,8 @@ push_coroutine< void >::~push_coroutine() { inline push_coroutine< void >::push_coroutine( push_coroutine && other) noexcept : - cb_{ other.cb_ } { - other.cb_ = nullptr; + cb_{ nullptr } { + std::swap( cb_, other.cb_); } inline