It's pretty straight forward, really. When you use the va_arg macro, the second argument is the received objects type. So, to receive a pointer to a type, you use va_arg(args, _Obj_*) where Obj is some object type - e.g. class, int, double, struct, etc. Here's a short working example:
#include
#include
struct S {
int data;
S(int d) : data(d) {}
};
void f(size_t n, ...)
{
va_list args;
va_start(args, n);
for(size_t i = 0; i < n; ++i) {
S* ptr = va_arg(args, S*);
std::cout << ptr->data << '\n';
}
}
int main()
{
S item1(1);
S item2(2);
S item3(3);
f(3, &item1, &item2, &item3);
}
Keep Calm and Carry On