-
data types types...
im pretty new to this kind of C++ and i was wondering if there is a way to determine what is the type of a pointer. say i got a void* that points to an int. how can i detect that? or pass an int* to a void* accepting function, then identifying its type.(e.g: without overloading...).
any help?
-
You don't. Keep the original pointer type. Overload the function or make it a template.
-
If there is no alternative whatsoever (e.g. you have a void * from a callback function) you just need to make sure you know the real type of the pointer. Pass only a single type of pointer in to it.
-
thanks for your posts. i think ill simply use void* and overloading. thanks.