在 C++ 中,为了创建一个包含 10 个整数向量的向量,我将执行以下操作:
std::vector< std::vector<int> > test(10);
因为我认为 Thrust 使用与 STL 相同的逻辑,所以我尝试做同样的事情:
thrust::host_vector< thrust::host_vector<int> > test(10);
但是我得到了太多令人困惑的错误。我试着做:
thrust::host_vector< thrust::host_vector<int> > test;
它起作用了,但是我不能向这个向量添加任何东西。正在做
thrust::host_vector<int> temp(3);
test.push_back(temp);
会给我同样的错误(太多了,无法在这里粘贴)。
一般来说,在使用 Thrust 时,使用host_vector
和 STL之间是否有区别vector
?
先感谢您