diff options
Diffstat (limited to 'win32/WinTypes.h')
-rw-r--r-- | win32/WinTypes.h | 19 |
1 files changed, 0 insertions, 19 deletions
diff --git a/win32/WinTypes.h b/win32/WinTypes.h index 9c930bb7c..c0d6c558d 100644 --- a/win32/WinTypes.h +++ b/win32/WinTypes.h @@ -38,25 +38,6 @@ struct UnknownReleaser { } }; -// Wrap COM IUnknown::QueryInterface to produce std::unique_ptr objects to help -// ensure safe reference counting. -template<typename T> -inline HRESULT UniquePtrFromQI(IUnknown *source, REFIID riid, std::unique_ptr<T, UnknownReleaser> &destination) noexcept { - T *ptr{}; - HRESULT hr = E_FAIL; - try { - hr = source->QueryInterface(riid, reinterpret_cast<void **>(&ptr)); - } catch (...) { - // Shouldn't have exceptions from QueryInterface but not marked noexcept - } - if (SUCCEEDED(hr)) { - destination.reset(ptr); - } else { - destination.reset(); - } - return hr; -} - /// Find a function in a DLL and convert to a function pointer. /// This avoids undefined and conditionally defined behaviour. template<typename T> |