0

I have created a struct to structure a table where the columns are thrust::device_vectors and gcc is complaining that I am not passing a template parameter.

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

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

How can I make it generic that I could have any sort of arbitrary template parameters for each column?

For example, one table could have 2 columns: 1 float device vector and an integer device vector.

1 Answers1

1

The compiler doesnt know which type of device_vector to create. You should use like this

template <typename T> 
struct table 
{ 
     thrust::device_vector<T> *columns; 
};
Sagar Masuti
  • 1,271
  • 2
  • 11
  • 30
  • this answer will only allow columns of the same type and not diverse ones. hence, it would not support both int and double columns. – user2991422 Nov 14 '13 at 10:58
  • Thats exactly supports any type you pass to it while creating the object. what exactly you want to do is not clear? Can you paste a pseudo code about what you want to do ? – Sagar Masuti Nov 14 '13 at 11:04
  • i want to generically create a table supporting arbitrary types for each device vector. for example i don't see how your solution solves this: a table consisting of device_vector, device_vector, device_vector, device_vector, { thrust::device_vector *col1; }; – user2991422 Nov 14 '13 at 11:14