I am trying to dynamically add elements to a vector contained in a map to store several arrays of Particle objects that map to different identifiers. I am new to the language, and therefore I had trouble understanding, can this be done only with iterators? In this case, this seems redundant. Is it possible to get direct access to the vector inside the map? Since I can access the map elements by key, and because there is only one vector for each key, it seems that this should be possible. I actually don't have the exact code, but it looks something like this:
int currentId = 1; map <int, vector<Particle> > particleMap; Particle p; particleMap[currentId] <access to vector somehow here?> push_back(p);
Iโm sure that some larger concept is missing here, but I really need a data structure of this type, so it would be great to know the correct way to access these types of โtablesโ.
source share