Hi all,
I have the following issue to solve.
I have a lookup table containing enum types for datatypes in different languages
std::string cTYPE | NUMPY type (Python) | Matlab Type
double | NPY_DOUBLELTR | mxDOUBLE_CLASS
.....
What I want to do is to determine the size of a particular type:
My program determines the corresponding types by looking them up th table above.
Given mxDOUBLE_CLASS, I get
std:air<std::string, int> p ; //storing string for cType and int for NUMPY constant
how can I use sizeof with the given name p.first to determine the size of the particular type.
In more detail, does
sizeof("double")
or
sizeof(p.first)
work?
Can I use the name stored in the string p.first as a template parameter for
some_function<p.first>(...)
If so, how do I do it? I try to avoid writing thousands of if cases.
Thank you in advance for your help,
Thomas