Let's assume the type of some variable is given and the actual data is in some place in memory. Ex:
const type &type, const void *key
key is a pointer to some object in memory. "It can be any object of any data type". If I know the type of the given object, how do I create the actual object with the right data type?
The range of type is int,realint and char. I guess a switch statement is needed in this case; however, variables inside a switch just work for that scope. I need the variable for further usage.
edit: RawN interpretation is right. How to create a new variable at run time by knowing the type.