I have a list of pointers to objects. These objects have nothing in common (i.e. no common base class); for better understanding: It is a list of objects that lie under the mouse cursor in a GUI.
Now I would like to know what kind of object it is. A node, a node handle, a line segment, a tag, and so on. However I cannot use typeid(*ptr) since ptr is a const void*.
Any solution for this? Can I force the usage of typeid since I know that the pointers always point to objects and not to mere values? Or is there no way around adding some fake common base class?
(edit: Currently I'm doing it that way that I store a struct in the list which additionally stores the type of the object (as enum). Maybe I should change this to store a type_info object ...)