vector<int> vector_of_pointers;
void create_vector() {
vector<map<int,structureA> > my_vector;
vector_of_pointers.push_back(&my_vector); // this not compile ....
}
I have a little confussion....
First, where is created 'my_vector' ? Have I a new instance each time >I call the function ? When the program ends, who delete the vectors ? Are they auto-deleted?
Second, I want to store the pointer to a vector to later use it to access to the each member. So , is the next right ? vector<map<int,structureA> > *a_my_vector = vector_op_pointers.at[x];
Thanks
Later I'd want to use the map element of the buffer_current to store data, buffer_current_map = &buffer_current[index];
But this last does not compile.... I dont know how to write it...
Can you help me ?
'buffer_current' is a pointer to vector< map<unsignedshortint,col_data> > hence this expression &buffer_current[index] remains that pointer just shifted by an index
You must dereference the pointer to the vector in order to get the content of the vector: buffer_current_map = (*buffer_current)[index];
To be honest that construct looks far too complicated/dangerous to get happy with