If I use thrust::transform on thrust::host, the lambda usage is fine
thrust::transform(thrust::host, a, a+arraySize,b,d,[](int a, int b)->int
{
return a + b;
});
However, if I change the thrust::host to thrust::device, The code wouldn’t pass the compiler. Here is the error on vs 2013
The closure type for a lambda (“lambda (int, int)->int”) cannot be used in the template argument type of a global function template instantiation, unless the lambda is defined within a device or global function
So the problem is how to add the device or global to lambda?