如何在OpenCL事件回调中从cl_event类型创建cl :: Event对象? 在OpenCL 2.0参考中有一个cl :: Event构造函数:
Event (const cl_event &event, bool retainObject=false)
在OpenCL 1.1中,只有继承的cl :: Event成员函数
Wrapper(const Wrapper<cl_event> & rhs)
这是我的回调函数:
void callback(cl_event ev, cl_int type, void *user_data)
{
cl::Event event;
event.Wrapper(cl::detail::Wrapper<cl_event>(ev));
}
编译错误:
main.cpp: In function 'void callback(cl_event, cl_int, void*)':
main.cpp:41:8: error: invalid use of 'cl::detail::Wrapper<_cl_event*>::Wrapper'
event.Wrapper(cl::detail::Wrapper<cl_event>(ev));
^
main.cpp:41:48: error: no matching function for call to 'cl::detail::Wrapper<_cl_event*>::Wrapper(_cl_event*&)'
event.Wrapper(cl::detail::Wrapper<cl_event>(ev));
^
main.cpp:41:48: note: candidates are:
In file included from main.cpp:23:0:
/usr/include/CL/cl.hpp:1106:5: note: cl::detail::Wrapper<T>::Wrapper(const cl::detail::Wrapper<T>&) [with T = _cl_event*]
Wrapper(const Wrapper<cl_type>& rhs)
^
/usr/include/CL/cl.hpp:1106:5: note: no known conversion for argument 1 from 'cl_event {aka _cl_event*}' to 'const cl::detail::Wrapper<_cl_event*>&'
/usr/include/CL/cl.hpp:1099:5: note: cl::detail::Wrapper<T>::Wrapper() [with T = _cl_event*]
Wrapper() : object_(NULL) { }
^
/usr/include/CL/cl.hpp:1099:5: note: candidate expects 0 arguments, 1 provided
由于