Updating a Map

Aug 30, 2008 at 3:26pm
Hi,

I have a map data structure defined as

std::map<<pair<int, int>, vector<aStruct> >
where aStruct is a structure. I don't want to use pointers in the map at the moment to keep things simple, well i'm newbie ;)

first, i read some data from a data file and update the fields in the structure and put them in the sturcture. I have two structures per key, so I use a vector to hold the two structs per key.

After I read all my datain, I want to update a member in the struct. What is the best way to do it. I thought about erasing the element in the map, and reinserting a vector<aStruct> with the updated fields, but I'm thinking there should be a better way.

I appreciate any help. Thank you very much.

Mike
Aug 30, 2008 at 3:35pm
Map[key][element].member=newData?
Aug 30, 2008 at 5:08pm
beautiful. Yes, it worked. Thanks you. ; )

mike
Topic archived. No new replies allowed.