[gameprogrammer] Re: stl container

Roger D Vargas wrote:
> What i need is something like this:
> <unique id, non unique id, data>
> And the container should be able to return an iterator of all data for a
> certain non unique id. I have a hash map of entities, each one with its
> id, but I would also like to access a group of them located in the same
> place (map). Thats why I was thinking in some quick solution like that.

OK, so do something like

  std::map<unique_key_type, data> Entities;

and

  std::map<non_unique_key_type, std::list<unique_key_type> > EntsByLoc;

We do something like this - multiple maps, where most of the maps just
map to the unique key of a master map - to let us access the data from
multiple perspectives quickly.
-- 
 Matthew Weigel
 hacker
 unique@xxxxxxxxxxx

---------------------
To unsubscribe go to http://gameprogrammer.com/mailinglist.html


Other related posts: