I'm looking to do something like this:
void func(void *data, const int dtype)
{
typedef typename std::conditional<dtype==0,float,double>::type DataType;
funcT((DataType *)data);
return;
}
This will not compile because dtype needs to be known at compile time. I'm trying to avoid using a switch statement, because I have 8 data types I am working with, with many functions such as the one above, being called from Python via ctypes.
Is there a way something like std::conditional can done during run time, making use of the dtype identifier passed in?
Aucun commentaire:
Enregistrer un commentaire