One area that is sorely missing in IDL’s library is more flexible collections. Sure, arrays are extremely powerful in IDL and we should try to use them whenever possible. But sometimes arrays are just not the right tool for the job. There are two main cases which arrays don’t handle well:
- Arrays can’t have zero elements.
- Adding an element to an array by concatenation repeatedly is extremely inefficient.
MGArrayList solves both of these problems. This is one thing in my library that I use on nearly every project.
I have a class on RSI’s User-Contributed Library called
Array_List which has most of the same functionality, but I wanted
MGArrayList to have exactly the same interface as
MGArrayList should do everything
IDL_Container does, but for all types instead of just objects.
Source code and
MGArrayList, its iterator, and parent classes. I intend to implement other collection classes such as hash tables, sets, and trees over the next few weeks.