I'm pretty sure I missed cases and introduced bugs with the new CGenerator triplit system, but I finally got all normal tests passing, and it's almost 5 in the morning, so I'm calling it a night. We have destructors and copy constructors now\! I need to work out copy assignment, but again, another day
This commit is contained in:
@@ -22,6 +22,12 @@ obj vector<T> (Destructable) {
|
||||
return this;
|
||||
}
|
||||
|
||||
fun copy_construct(old: vector<T>*): void {
|
||||
construct(old->size)
|
||||
for (var i = 0; i < size; i++;)
|
||||
set(i, old->get(i))
|
||||
}
|
||||
|
||||
fun destruct(): void {
|
||||
delete<T>(data);
|
||||
}
|
||||
@@ -74,6 +80,10 @@ obj vector<T> (Destructable) {
|
||||
resize(size*2);
|
||||
data[size-1] = dataIn;
|
||||
}
|
||||
fun do(func: fun(T):void):void {
|
||||
for (var i = 0; i < size; i++;)
|
||||
func(data[i])
|
||||
}
|
||||
fun in_place(func: fun(T):T):void {
|
||||
for (var i = 0; i < size; i++;)
|
||||
data[i] = func(data[i])
|
||||
|
||||
Reference in New Issue
Block a user