diff options
Diffstat (limited to 'core/fxcrt')
-rw-r--r-- | core/fxcrt/cfx_retain_ptr.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/core/fxcrt/cfx_retain_ptr.h b/core/fxcrt/cfx_retain_ptr.h index 62b26942ba..0267ae04cd 100644 --- a/core/fxcrt/cfx_retain_ptr.h +++ b/core/fxcrt/cfx_retain_ptr.h @@ -30,6 +30,11 @@ class CFX_RetainPtr { template <class U> CFX_RetainPtr(const CFX_RetainPtr<U>& that) : CFX_RetainPtr(that.Get()) {} + template <class U> + CFX_RetainPtr<U> As() const { + return CFX_RetainPtr<U>(static_cast<U*>(Get())); + } + void Reset(T* obj = nullptr) { if (obj) obj->Retain(); |