How to check what is a runtime type under a void* pointer. For example, how to write such a function:
void f(void *p) {
// check if *p is an int or a vector
}
Modern C++ versions (14, 17) are welcome. Future versions are also interesting as an information for the future.
There is no base class nor common virtual methods and simple types are allowed, so How to determine actual object type at runtime in C++; is not exactly relevant.
EDIT:
OK, in certain cases, if the caller knows the real type of the pointer, overloads could be a solution for the simplified example above. But what about something slightly more complex:
using ::std::vector;
void f(vector<void*> v) {
// check if particular *v[i]'s are ints or vectors
}
Also void* in a function declaration was not my idea.