lithander
04-02-2005, 02:46 PM
Hi!
I've items that need to be stored in sorted order. The value they need to be sorted by is an integer (or even better a float) key. I'f I'd work with TList I had to call sort whenever an items key changes wich will perform a quicksort on the list. What I search for is a map where i can enter an Item together with a key like the STL map in C++. When a key changes I'd just remove the item from the map and enter a new one. This would be rather fast. (2 * O(log n))
Still i could run through all items almost as fast as in a tree via an iterator.
Is there any implementiation of such a container in Delphi?
-lith
I've items that need to be stored in sorted order. The value they need to be sorted by is an integer (or even better a float) key. I'f I'd work with TList I had to call sort whenever an items key changes wich will perform a quicksort on the list. What I search for is a map where i can enter an Item together with a key like the STL map in C++. When a key changes I'd just remove the item from the map and enter a new one. This would be rather fast. (2 * O(log n))
Still i could run through all items almost as fast as in a tree via an iterator.
Is there any implementiation of such a container in Delphi?
-lith