Changed from typedef to obj and def
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import vector;
|
||||
import mem;
|
||||
|
||||
typedef string (Destructable) {
|
||||
obj string (Destructable) {
|
||||
var data: vector::vector<char>;
|
||||
fun construct(): string* {
|
||||
data.construct();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import io;
|
||||
|
||||
typedef trivialContainer<T> {
|
||||
obj trivialContainer<T> {
|
||||
var data: T;
|
||||
fun print(): void {
|
||||
io::print(data);
|
||||
|
||||
@@ -2,7 +2,7 @@ import mem:*;
|
||||
import util:*;
|
||||
import io:*;
|
||||
|
||||
typedef vector<T> (Destructable) {
|
||||
obj vector<T> (Destructable) {
|
||||
var data: T*;
|
||||
var size: int;
|
||||
var available: int;
|
||||
@@ -13,7 +13,7 @@ typedef vector<T> (Destructable) {
|
||||
data = new<T>(8);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
fun construct(newSize: int): vector<T>*{
|
||||
size = newSize;
|
||||
available = newSize;
|
||||
@@ -48,7 +48,7 @@ typedef vector<T> (Destructable) {
|
||||
print("Vector tried to access element: ");
|
||||
println(index);
|
||||
print("Max Index of vector: ");
|
||||
println(size-1);
|
||||
println(size-1);
|
||||
return data[0];
|
||||
}
|
||||
return data[index];
|
||||
|
||||
Reference in New Issue
Block a user