std::unique_ptr, deleters and the Win32 API
Forget about the custom deleter for now. When you say std::unique_ptr<T>, the unique_ptr constructor expects to receive a T*, but CreateMutex returns a HANDLE, not a HANDLE *. There are 3 ways to fix this: std::unique_ptr<void, deleter> m_mutex; You’ll have to cast the return value of CreateMutex to a void *. Another way to do … Read more