Abuse of the TMap?

BlitzMax Forums/BlitzMax Programming/Abuse of the TMap?

beanage(Posted 2010) [#1]
Hey,

I recently discovered the use of the "Compare" Method, and had a brief view into the TMap code. I always noticed, that Objects in the Map are "sorted" in some obfuscating way. Until recently, when I, just for testing, overrided the "compare" Method with custom one of mine, and tadaaa!

Suddenly I could use the TMap not only to .. map stuff, but even to sort it! And since I just need a good sorting technique, where the sorting should ideally take place alongside with the inserting, I'd like to know, how much of a big deal would that "map sorting" be (regarding speed, mem etc)?

Here is my test:



plash(Posted 2010) [#2]
Abuse of the TMap?
Impossible.


Muttley(Posted 2010) [#3]
I always noted, that Objects in the Map are "sorted" in some obfuscating way


Not really obfuscating. TMap uses a Red-black Tree IIRC: http://en.wikipedia.org/wiki/Red-black_tree