Skip to content

Instantly share code, notes, and snippets.

@somma
Created March 26, 2014 07:50
Show Gist options
  • Save somma/9778478 to your computer and use it in GitHub Desktop.
Save somma/9778478 to your computer and use it in GitHub Desktop.
class handle_placeholder
{
public:
handle_placeholder(HANDLE handle): _handle(handle){}
~handle_placeholder(){ close(); }
void close()
{
if (INVALID_HANDLE_VALUE != _handle)
{
CloseHandle(_handle);
_handle = INVALID_HANDLE_VALUE;
}
}
HANDLE get() { return _handle; }
private:
HANDLE _handle;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment