Add move constructor and move assignment operator

This commit is contained in:
josh committed 2026-02-24 15:18:41 -05:00
1 parent 2e30a9f407
commit 62b729badd
2 files changed
+71

No files matched your search

+19
View File
@@ -70,6 +70,25 @@ public:
return *this;
}
rcp(rcp && other) noexcept : ptr(other.ptr)
{
other.ptr = nullptr;
}
rcp<T> & operator=(rcp && other) noexcept
{
if (ptr != other.ptr)
{
if (ptr)
{
ptr->rcp_dec();
}
ptr = other.ptr;
other.ptr = nullptr;
}
return *this;
}
~rcp()
{
if (ptr)