Here is an early implementation of a dynamic array for Ecere…
It is most likely a interim solution until truer “templates” make an apparition in eC.
Download Array.ec
(Please don’t mind the obscurity of the internals. Like all things, it’s impermanent.)
You would use it as such:
import “Array”
public class ArrayPoint : Array
{
type = class(Point);
public Point * points;
};
void Test()
{
ArrayPoint points { size = 10 };
points.points[0] = { 10, 10 };
points.size = 20;
points.points[19] = { 5, 5 };
delete points;
}
The truer templates have arrived!
See release 0.43 notes at:
http://www.ecere.com/blog/2008/09/03/ecere-sdk-043-templates-syntax-highlighting/
This example would now read:
void Test() points { size = 10 };
{
Array
points[0] = { 10, 10 };
points.size = 20;
points[19] = { 5, 5 };
delete points;
}