Original Post
Its a bit difficult to explain what I would like to ask, so here's an example. and pass that to Foo(). But I'm not sure if this is even possible (or advised), and doing a quick test doesn't seem like it is. Does anyone have any good suggestions for how to solve this problem? Note that I do *not* want to create a separate class for representing the vectors which contain Base/A/B/C/D and pass that to Foo (I know it would solve the problem, but it would screw up the design of some other parts of my code that uses these vectors).
class Base {}; // Base is an abstract class
class A : public Base {};
class B : public Base {};
class C : public Base {};
class D : public Base {};
vector<A*> va;
vector<B*> vb;
vector<C*> vc;
vector<D*> vd;
void Foo(vector<Base*>& v) {}
int main() {
// These calls to Foo won't compile =(
Foo(va);
Foo(vb);
Foo(vc);
Foo(vd);
return 0;
}
So what it seems I need to do to get this to compile is to cast va/vb/vc/vd to type vector