Per Paragraph 14.3.2/1 of the C++11 Standard:
A template-argument for a non-type, non-template template-parameter shall be one of:
— for a non-type template-parameter of integral or enumeration type, a converted constant expression (5.19) of the type of the template-parameter; or
— the name of a non-type template-parameter; or
— a constant expression (5.19) that designates the address of an object with static storage duration and external or internal linkage or a function with external or internal linkage, [...]
— [...]
This means that even though the GUID
itself cannot be used as a template argument, you can use the address of the global GUID
as an argument, and a pointer to GUID
as the corresponding non-type parameter:
template<GUID const* pGuid>
struct dll { };
template<>
struct dll<&CLSID_EH264VD>
// ^^^^^^^^^^^^^^
// This is a constant expression
{
char const* filename = ""mc_dec_avc_ds.ax";
}
// ...
dll<&CLSID_EH264VD> x;