In OpenCL’s C++ header file, line 1611, there is code as below:
template <typename enum_type, cl_int Name>
struct param_traits {};
#define CL_HPP_DECLARE_PARAM_TRAITS_(token, param_name, T)
struct token;
template<>
struct param_traits<detail:: token,param_name>
{
enum { value = param_name };
typedef T param_type;
};
It first defines a struct template. Then it defines a macro. It seems when the macro is expanded, it will specialize the struct, and it will add members into the structure also. I’m not very familiar with the newer C++ standard. So, how the code works here?