Skip to content

Commit 8a984d8

Browse files
committedNov 15, 2023
OrcLib: Utils: Guard: PointerGuard: add operator=
1 parent 4b75310 commit 8a984d8

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed
 

‎src/OrcLib/Utils/Guard.h

+12-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ class PointerGuard
8383
PointerGuard& operator=(const PointerGuard&) = delete;
8484
PointerGuard(const PointerGuard&) = delete;
8585

86-
PointerGuard(PointerGuard&& o)
86+
PointerGuard(PointerGuard&& o) noexcept
8787
{
8888
m_data = o.m_data;
8989
o.m_data = nullptr;
@@ -106,6 +106,17 @@ class PointerGuard
106106

107107
T* operator->() const noexcept { return m_data; }
108108

109+
PointerGuard& operator=(PointerGuard&& o) noexcept
110+
{
111+
if (this != &o)
112+
{
113+
m_data = o.m_data;
114+
o.m_data = nullptr;
115+
}
116+
117+
return *this;
118+
}
119+
109120
protected:
110121
T* m_data;
111122
};

0 commit comments

Comments
 (0)
Please sign in to comment.