Extend Array?

BlitzMax Forums/BlitzMax Programming/Extend Array?

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

I can't really think of a way to do this but is there a TArray object you could extend? I don't think there is.

Why? Well you could extend it and make your array handle a specific Type. It could have a method to initialise the array so it wasn't null pointers, and a method to clean it out, and a method to add new objects to it etc. Yet you could still access it like MyArray[0].X or whatever. That would be nice. This is possible in C++ with overloading of course, you specify what the square brackets do.

I know I could embed the array in a type (wrap it) but then I won't be able to access it with [].

Yes I know I've just described the functionality of a TList (sort of), but I really wanted an array for speed and *reuseability* etc. I'm fed up of having to keep writing the same type of functions to handle arrays. Oh well. Just rambling...