Assume I have an interface
class I{
public:
virtual void f(int id)=0;
virtual void g(int id, float x)=0;
}
I need a proxy class, to do some sort of id to pointer mapping
class Proxy : I
{
I * i[5];
public:
void f(int id)
{
i[id]->f(id);
}
void g(int id, float x)
{
i[id]->g(id, x);
}
}
So when i write
Proxy *p;
p->f(1);
f is called on the object with id=1
there are several such cases and interfaces are rather large. So I don't want to code all the functions in the proxy class. Is there way to do it automatically? maybe using macros, templates, overloading "->" etc.