win32/ComPtr: operator*() returns reference

This commit is contained in:
Max Kellermann 2021-03-05 16:53:15 +01:00
parent bc2988144e
commit ebc1fe2821
1 changed files with 2 additions and 1 deletions

View File

@ -32,6 +32,7 @@ template <typename T>
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,