Related topic
std::unique_ptr, deleters and the Win32 API
To use a Win32 Handle as a RAII, I can use the following line
std:
Kerrek SB answered in the comments and it was exactly what I was looking for!
template struct stateless_deleter { typedef T pointer; void operator()(T x) { Deleter(x); } }; std::unique_ptr> listenSocket(socket(AF_UNSPEC, SOCK_STREAM, IPPROTO_UDP));