Add specialized operator=() to handle nullptr assignment
This commit is contained in:
1 parent
e3cdfb1bfa
commit
b695ce7758
2 files changed
+31
No files matched your search
@@ -23,6 +23,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <atomic>
|
||||
#include <cstddef>
|
||||
#include <functional>
|
||||
#include <type_traits>
|
||||
|
||||
@@ -59,6 +60,16 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
rcp & operator=(nullptr_t) noexcept
|
||||
{
|
||||
if (ptr)
|
||||
{
|
||||
ptr->rcp_dec();
|
||||
ptr = nullptr;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
rcp & operator=(const rcp & other)
|
||||
{
|
||||
if (ptr != other.ptr)
|
||||
|
||||
Reference in new issue
Block a user