From 6d0bd1a5320e3103b10e5263732566c9d63981d9 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Fri, 25 Mar 2022 16:36:46 -0700 Subject: Simplify some move assignments --- common/comptr.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'common/comptr.h') diff --git a/common/comptr.h b/common/comptr.h index 5984ebd9..3dc574e8 100644 --- a/common/comptr.h +++ b/common/comptr.h @@ -46,10 +46,8 @@ public: { if(likely(&rhs != this)) { - if(mPtr) - mPtr->Release(); - mPtr = rhs.mPtr; - rhs.mPtr = nullptr; + if(mPtr) mPtr->Release(); + mPtr = std::exchange(rhs.mPtr, nullptr); } return *this; } -- cgit v1.2.3