Jump to content
  • Advertisement
Sign in to follow this  
Calin

C++ containers

This topic is 4234 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'm having a number of C++ problems that are quite a challenge. I can do this in C# blind folded yet I feel lost in C++. I'm making a function that will get called from a script file. The function will create objects on the heap. It will allow me to define by scripting the objects that get loaded to the game. In C# I would place the new objects into a List. C++ has several options (std, boost, etc) and in many cases people build their own linked lists. My object class will contain pointers to Irrlicht (the rendering engine I'm using )resources like textures and meshes So what would be the best container to use? Calin.

Share this post


Link to post
Share on other sites
Advertisement
You select containers based on the characteristics you need. vector is random access, low access overhead, good when elements are added or deleted from the end, sucks when adding or deleting from other places. list trades random access for more efficient insertions and deletions anywhere in the list. deque is basically vector with a bit of extra overhead to make insertions and deletions in the front as efficient as in the back, etc.

Figure out what you need from your container. We can't help you much until then.

Share this post


Link to post
Share on other sites
std, i.e. the STL, is the default built-in library. boost is an external library that'd you have to download and configure. I've always used the STL, people are a fan of boost. I'd start with the STL because it's, you know, standard. After that you should check out boost and see what it has to offer.

-me

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!