Created
July 15, 2017 05:04
-
-
Save dbremner/71e547ccece3ff14d99bc990d543b9b8 to your computer and use it in GitHub Desktop.
base class for KennyKerr::unique_handle (https://dx.codeplex.com)
This file contains hidden or 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
template<class T, T invalid_value=nullptr> | |
struct handle_traits_base | |
{ | |
using pointer = T; | |
inline static pointer invalid() throw() | |
{ | |
return invalid_value; | |
} | |
}; | |
//sample use | |
struct hdesk_traits : handle_traits_base<HDESK> | |
{ | |
static void close(pointer ptr) throw() | |
{ | |
CloseDesktop(ptr); | |
} | |
}; | |
using unique_hdesk = KennyKerr::unique_handle<hdesk_traits>; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment