From ebc1fe2821e152aca453466978848f0d698697cd Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 5 Mar 2021 16:53:15 +0100 Subject: [PATCH] win32/ComPtr: operator*() returns reference --- src/win32/ComPtr.hxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/win32/ComPtr.hxx b/src/win32/ComPtr.hxx index 325c06c10..01a8ef525 100644 --- a/src/win32/ComPtr.hxx +++ b/src/win32/ComPtr.hxx @@ -32,6 +32,7 @@ template class ComPtr { public: using pointer = T *; + using reference = T &; using element_type = T; constexpr ComPtr() noexcept : ptr(nullptr) {} @@ -75,7 +76,7 @@ public: pointer get() const noexcept { return ptr; } explicit operator bool() const noexcept { return ptr; } - auto operator*() const { return *ptr; } + reference operator*() const noexcept { return *ptr; } pointer operator->() const noexcept { return ptr; } void CoCreateInstance(REFCLSID class_id, LPUNKNOWN unknown_outer = nullptr,