I would like to make a vector of vectors of different types. Suppose I have 4 classes; Dog, Cat, Pig, Cow. I would like a vector that contains vectors of each of these, and a function to access them by two indices.
but haven't got there yet. Furthermore, I'd like to be able to construct these arrays with a variadic template construct, so I could easily make another vector of vectors of, say, Apple, Pear, Orange, Lemon, Grape, Cherry.
class Animal { ... }; // make it abstract if you wish
class Dog: public Animal { ... };
class Cat: public Animal { ... };
...
std::vector <std::vector <Animal*> > MyArrayOfAnimals;
Now, after that, this is my advice: you are making a design mistake.
Whatever it is you are trying to accomplish, you are getting tripped up by trying to be fancy with the language. Knock it off. Rethink the problem and come up with another solution.
Can you describe the problem you're trying to solve (as opposed to the solution you've come up with). I agree with Duthomhas that you're probably making a design mistake and there's probably an easier way.