Jump to content
  • Advertisement
Sign in to follow this  
sipickles

Recommend a data structure for my GUI

This topic is 4589 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

Hi, Like Orangytang, I am developing my own GUI library for use with directx I am a bit stuck tho, and wondered if anyone might be able to help. Which data structure should I use to hold a list of children of a window? It seems like I want everything, random access, speed, insertion and deletion at any point.... Am i being slow or is a std::vector fine.... Thanks Simon

Share this post


Link to post
Share on other sites
Advertisement
I'm using std::list in my GUI implementation. This works neatly for all kind of things. I do have some special constructs for removing components during the GUI events (it's not a good idea to really do the delete if you're still in the components event handler).

I don't need random access, what would you use it for? Everything else is covered by std::list.

Share this post


Link to post
Share on other sites
Yeah, list is the best option, I think. You don't really need random access as you will could do stuff with windows using their own handlers, instead of accessing the element by the container itself.

Share this post


Link to post
Share on other sites
How many child will you have ? Unless you don't have to handle countless widgets, the choice of a container is rather simple: use the one you like. If, later, you show that the container is too slow to be usable, then change it.

Both vector and list fits the bill, but unless you really need a random access to your child widgets, I suggest you to use a list.

Regards,

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!