Skip to content

Instantly share code, notes, and snippets.

@markusl
Created February 24, 2014 05:35
Show Gist options
  • Save markusl/9182479 to your computer and use it in GitHub Desktop.
Save markusl/9182479 to your computer and use it in GitHub Desktop.
struct handle_deleter_t
{
void operator()(HANDLE handle) {
if(handle != INVALID_HANDLE_VALUE)
CloseHandle(handle);
}
};
void foo()
{
std::unique_ptr<std::remove_pointer<HANDLE>::type, handle_deleter_t> HandlePtr;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment