Hello, I'm pretty new to c++. I have been using it for a little over 3 weeks. I programmed in Visual Basic .net for a few years before that but now I'm trying to break away from microsoft dependance. Anyway to the point. I want to make a class that works like a hashtable with a string or character array for a key and a SDL_Surface for a value. The hard part is I would like it to store the data in 2 different places I would like it to keep Surfaces that are used alot in video memory but swap little and not used surfaces to system memory because most people have more system memory than video memory. I was thinking that the function to sort/swap the surfaces could be called from my game loop. Maybe I should have asked this on a gamming forum but I thought this was more of a data structure question. Anyway please help!
Off the top of my head, I would say that you can use a container class that meets your needs, but the standard containers don't include a hash table yet, and then write a custom allocator that does what you want. But, with such little experience using C++, that's not really a good solution. You're better off just using what you do know to approximate what you want to do. :)
>The hard part is I would like it to store the data in 2 different places
As long as you know how to differentiate between the data that's stored in video memory and the data that's stored in system memory, and how to do the actual storage of course, it shouldn't be too hard to write a specialized class that does what you want.
>Maybe I should have asked this on a gamming forum but I thought this was more of a data structure question.
It's probably more of a game question, so it couldn't hurt to ask there too. At least then you'll be talking to people who are doing the same things as you're trying to do since the forum is more specialized than this one. I don't write games. ;)