Template Question

Hi,

I’m new to CUDA programming. I’m trying to make something similar to a generic factory method in CUDA C.

enum enumPoolType
{
INT,
LONG,
FLOAT,
DOUBLE
};

void* Create(enumPoolType poolType)
{
switch(poolType)
{
case INT:
Pool pool;
return &pool;
break;
case LONG:
Pool pool;
return &pool;
break;
case FLOAT:
Pool pool;
return &pool;
break;
case DOUBLE:
Pool pool;
return &pool;
break;
}
}

I know this code is all messed up. I’m trying to figure out what to do and I’m not quite sure how to explain it. I know I have to instantiate the template class. This compiles but how can I have a pointer to it on the left side.

Feel free to beat me like the noob I am. I have no self esteem that I am aware of…

Thanks,
Darren