Created
November 16, 2014 12:18
-
-
Save asm256/838172381b960533eaf2 to your computer and use it in GitHub Desktop.
smart_handle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct HANDLE_deleter | |
{ | |
typedef HANDLE pointer; | |
void operator () (HANDLE handle) | |
{ | |
CloseHandle(handle); | |
} | |
}; | |
typedef std::unique_ptr< HMODULE, HANDLE_deleter > unique_handle; | |
struct HMODULE_deleter | |
{ | |
typedef HMODULE pointer ; | |
void operator () ( HMODULE handle ) | |
{ | |
FreeLibrary( handle ); | |
} | |
}; | |
typedef std::unique_ptr< HMODULE, HMODULE_deleter > unique_hmodule; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment