Jump to content
  • Advertisement
Sign in to follow this  
luasitdown

map question

This topic is 4833 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I see ogre make map : map<material,renderable*> so render code will render renderable according to material. but I see no reason to use map,just two vector work too. vector<material> vector<renderable*> so why use map?

Share this post


Link to post
Share on other sites
Advertisement
I haven't looked at the code... but are they using "find" at all? If not, then there's no point to using a map over parallel vectors.

Share this post


Link to post
Share on other sites
IIRC, maps are better at random access then vectors, plus you can find objects based on a key instead of iterating through them until you hit the right one. It's more a matter of design, I guess, to use a map over parallel vectors, because the map would signify, at least to me, that the objects are linked together and use each other, whereas parallel vectors would say nothing of the sort.

[EDIT] Don't quote me on that though, I could be wrong.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!