From 6bf49d619acab948f9b9eb46f8f08d48f6748c75 Mon Sep 17 00:00:00 2001 From: Oliver Kowalke Date: Wed, 20 Dec 2017 06:22:27 +0000 Subject: [PATCH] Update push_coroutine.hpp --- include/boost/coroutine2/detail/push_coroutine.hpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/include/boost/coroutine2/detail/push_coroutine.hpp b/include/boost/coroutine2/detail/push_coroutine.hpp index 4b183a7..45ae170 100644 --- a/include/boost/coroutine2/detail/push_coroutine.hpp +++ b/include/boost/coroutine2/detail/push_coroutine.hpp @@ -133,8 +133,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; } @@ -211,8 +210,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; }