Let's say I have a few variables of different types.
int MyInteger;
double MyDouble;
char MyChar;
Pointers to these variables are stored in a single array of void pointers.
void* IntegerPointer = &MyInteger;
void* DoublePointer = &MyDouble;
void* CharPointer = &MyChar;
void* PointerArray[] = {IntegerPointer, DoublePointer, CharPointer};
I'd like to store the datatype information in a parallel array. type_info
seems to be suited to the task, but assignment isn't supported. So I can't just do something like this:
type_info TypeInfoArray[] = {int, double, char};
Is there any other way to store information about a datatype?
I suggest you use a variant type. I hate to say it, but try boost::variant (or something similar). Forget all this parallel array and void pointer stuff; a single array of variants achieves the same thing and is more elegant.