I would like to define a struct Primitives
that contains containers that hold non struct-templated types as I tried to bellow. The structs Sphere
, Plane
and Triangle
are all defined before this struct as well as the enum Device
. I would like for the container of these types to be templated by the user of the struct without specifying the types they hold as the struct should do that. An arbitrary container type might looks like (in my case since I'm abstracting CUDA host/device memory):
template <typename T, Device D>
struct my_container {
/*...*/
};
And the Primitives
class I would like to define looks like:
template <typename Container, Device D>
struct Primitives {
Container<Sphere, D> spheres;
Container<Plane, D> planes;
Container<Triangle, D> triangles;
}; // Primitives
When I compile it with nvcc
on windows which uses cl.exe
, I get the error message:
error: template parameter "Container" may not have a template argument list
I understand why I get this message but I don't know if there is a way to achieve what I want to do.