0

我创建了一个结构来构造一个表,其中列是推力::device_vectors 并且 gcc 抱怨我没有传递模板参数。

struct table 
{
    thrust::device_vector *columns;
};

error: argument list for class template "thrust::device_vector" is missing

我怎样才能使它成为通用的,我可以为每列有任何类型的任意模板参数?

例如,一个表可能有 2 列:1 个浮点设备向量和一个整数设备向量。

4

1 回答 1

1

编译器不知道要创建哪种类型的 device_vector。你应该这样使用

template <typename T> 
struct table 
{ 
     thrust::device_vector<T> *columns; 
};
于 2013-11-14T10:53:33.797 回答