samedi 4 février 2017

vector of existing objests

I have some objects (they are vectors in this example) and I want them to be stored in a vector but don't know how to declare it properly. My code is:

vector<string> A;
vector<string> B;
vector<vector<string>> Tables={A,B};

Of course it duplicates A and B before copying it into Tables. The question is: How do I create a table of poiters to A and B so i can operate on them actually while using Tables?

I want to be able to write to A and B using

Tables[position].push_back(sub);

and read the tables with simple A[i] and later use it in more complicate functions.

Aucun commentaire:

Enregistrer un commentaire