v1 is a container of a1 struct and v2 is a container of a2 struct.
The objects of type a1 and a2 are many.
I must have access at two conatainers, v1 and v2 from another container, the all.
While perhaps not a very elegant solution, you can do this by making your vector store pointers to arbitrary data, along with some kind of data that you can use to identify what kind of vector the pointer points to.
The OP's problem is that s/he's trying to use vector<base>. This will cause any object being copied into it to be sliced, so that the objects stored in it are only of type base, not of their original type.
Instead, they should be using a vector<base*>, and storing pointers to the objects rather than sliced copies of the objects. Then, the overall list can be of type vector<vector<base*>>.
If a1 and a2 both have the same data members in common, why aren't those data members in the base class?
Edit: To answer your question in a more general sense: a pointer to the base class will only allow you to access:
a) members of the base class
b) members of the base class that are polymorphically overridden in subclasses
If you want to treat your pointer as if it were a pointer to a1, you need to cast it to one. I'd reccomend reading up on the different types of C++ casts.
No, a1 and a2 don't have same data, i write it wrong...
Unfortunately structs a1,a2, ... and vectors v1,v2,... are too many(>1000).
How i can cast all these stuff?
I am looking for a simple method to access all stuff.
@OP: You're trying to do X, and you thought of solution Y.
So you're asking about solution Y, without even mentioning X.
The problem is, there might be a better solution, but we can't know that unless you describe what X is.
solution X and Y resolve the same problem.
Different structs cary solution of different problems.
A matter has many solutions, that many same type of structs cary.
The matters are many=1000 and i have 2-3000 solutions in a 1000 vectors.
// two solutions of a matter 1 with struct a1 in vector v1