OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

How the struct 'param_traits' is defined in OpenCL?

  • Thread starter Thread starter diverger
  • Start date Start date


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. It's strange that it add members into the structure also. I'm not very familiar with the newer C++ standard. So, how the code works here?
Continue reading...

Latest posts