I am having trouble inserting data into this map. I honestly can not figure out the way to do this, but the last line of the code I gave is the part that I need fixed.
map<string, vector<vector<Obj*>* >* > the_map;
vector<vector<Obj*> *>* vectors = new vector<vector<Obj*> *>;
vector<Obj*> Obj_vector;
vectors->push_back(&Obj_vector);
the_map.insert(make_pair(string("field1", &vectors)); //error on this line only
Try this:
By the way, I suspect the usage of so many pointers in your code, and especially these two lines:
Inserting address of a local variable into vector?
Beware that the local variable wouldn’t exist after it goes out of scope, which in turn, means that the address which you just inserted into the vector, points to the destroyed object, and using it would invoke undefined behaviour.