Add specialized operator=() to handle nullptr assignment

This commit is contained in:
josh committed 2026-02-27 14:50:48 -05:00
1 parent e3cdfb1bfa
commit b695ce7758
2 files changed
+31

No files matched your search

+11
View File
@@ -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)