[gameprogrammer] Re: stl container
- From: Matthew Weigel <unique@xxxxxxxxxxx>
- To: gameprogrammer@xxxxxxxxxxxxx
- Date: Wed, 29 Aug 2007 14:39:39 -0500
Roger D Vargas wrote:
> Is there some stl strcture that let me store elements with multiple
> keys, and one of those keys repeated?
You mean, something like a std::map but one key can correspond to
multiple values? You might try doing this:
std::map< key_type, std::list<value_type> >
I'm not sure what you mean by "multiple keys," but if you mean you want
multiple key types all mapping to the same set of data, you can simply
use multiple maps, and use pointers for the value_type (so accessing a
value_type object from any map will return a pointer to one object,
rather than a copy stored in each map). You have to be careful, in that
case, to remove an object from all maps before calling delete on the
pointer.
--
Matthew Weigel
hacker
unique@xxxxxxxxxxx
---------------------
To unsubscribe go to http://gameprogrammer.com/mailinglist.html
- Follow-Ups:
- [gameprogrammer] Re: stl container
- From: Roger D Vargas
- References:
- [gameprogrammer] stl container
- From: Roger D Vargas
Other related posts:
- » [gameprogrammer] stl container
- » [gameprogrammer] Re: stl container
- » [gameprogrammer] Re: stl container
- » [gameprogrammer] Re: stl container
- » [gameprogrammer] Re: stl container
- » [gameprogrammer] Re: stl container
- » [gameprogrammer] Re: stl container
- » [gameprogrammer] Re: stl container
- » [gameprogrammer] Re: stl container
- » [gameprogrammer] Re: stl container
- » [gameprogrammer] Re: stl container
- [gameprogrammer] Re: stl container
- From: Roger D Vargas
- [gameprogrammer] stl container
- From: Roger D Vargas