What's the correct usage of thrust::device_vector as class member?
I am trying to write a struct, which has thrust::device_vector as its member. I expect the following code
#include <iostream>
#include <thrust/device_vector.h>
#include <thrust/host_vector.h>
struct ABC
{
ABC() : wh(3,10)
{};
void clear()
{
wh.clear();
}
thrust::device_vector<int> wh;
};
int main()
{
ABC abc;
std::cout << abc.wh.size() << std::endl;
for (size_t i = 0; i < abc.wh.size(); ++i)
{
std::cout << abc.wh[i] << ' ';
}
return 0;
}
to produce
3
10 10 10
but instead I'm getting
3
0 0 0
CLion also marks initialization of wh vector with an error of
ambiguous partial specializations of 'pointer_element<thrust::pointer<void, thrust::cuda_cub::tag, thrust::tagged_reference<void, thrust::cuda_cub::tag>>>'
but the code compiles without errors.
What's the nature of these errors which I'm getting from the IDE, and why the code compiles in the end?