Monday, September 10, 2007

ListBoxes and STL

Writing listbox code today. how dull. At least you only need to write it once, and I already had button and scrollbar code, so its not too bad.
They are for the player selecting the names of his party, and the opposition party. I haven't made them slide in and out like the fancy windows ones yet.
also did some optimising, looked into why list.remove() is so slow.
i didn't realise that the STL list remove() is looking for multiple matches. so if you have 2,000 items in the list and want to remove the 3rd one, it does 2,000 comparisons. There should be a way for you to say "I know items are unique, so seriously, just stop once you find it". But there isn't. also encountered slist, which is a 1 way list that may be better for my needs, and faster.
My biggest list has about 3,000 items in. 2,000 voters plus a thousand or so other objects.

Links to this post:

Create a Link

<< Home