A
ashish.sadanandan
Hi,
I haven't done a lot of C++ programming (done a lot of it in C) and the
reason why I'm considering switching now is also the question I'm
posting here.
I have some library functions that return to me a void* to data that
has been specifed by the user. There are also functions that return an
enum which contains information about the data type of this data. So
what I've done in the past is made a switch case statement based on the
data type enum and then explicitly re-cast the void* to the appropriate
data type.
Now I have a case where I have two values and each of them could be any
data type. Lets say I have to multiply them. So if I was to use my
usual method I'd have a switch case statement with numDataType(C)2
(combination) cases. Does C++ have a better way of extracting data from
void*?
Thanks for your help,
Ashish.
I haven't done a lot of C++ programming (done a lot of it in C) and the
reason why I'm considering switching now is also the question I'm
posting here.
I have some library functions that return to me a void* to data that
has been specifed by the user. There are also functions that return an
enum which contains information about the data type of this data. So
what I've done in the past is made a switch case statement based on the
data type enum and then explicitly re-cast the void* to the appropriate
data type.
Now I have a case where I have two values and each of them could be any
data type. Lets say I have to multiply them. So if I was to use my
usual method I'd have a switch case statement with numDataType(C)2
(combination) cases. Does C++ have a better way of extracting data from
void*?
Thanks for your help,
Ashish.