mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-09-01 15:49:51 +08:00
libobs: Support move for mismatched ComPtr
This commit is contained in:
@@ -58,6 +58,10 @@ public:
|
||||
ptr->AddRef();
|
||||
}
|
||||
inline ComPtr(ComPtr<T> &&c) noexcept : ptr(c.ptr) { c.ptr = nullptr; }
|
||||
template<class U>
|
||||
inline ComPtr(ComPtr<U> &&c) noexcept : ptr(c.Detach())
|
||||
{
|
||||
}
|
||||
inline ~ComPtr() { Kill(); }
|
||||
|
||||
inline void Clear()
|
||||
@@ -91,6 +95,14 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<class U> inline ComPtr<T> &operator=(ComPtr<U> &&c) noexcept
|
||||
{
|
||||
Kill();
|
||||
ptr = c.Detach();
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline T *Detach()
|
||||
{
|
||||
T *out = ptr;
|
||||
|
||||
Reference in New Issue
Block a user