libobs: Support move for mismatched ComPtr
parent
1588357583
commit
23f43f46db
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue