namespace; include rt; // growable arrays and fixed ones struct point { int x, y; }; fn main() { let before = rt.live_objects(); { int[?] a = rt.new(int[?]); for (int i = 0; i < 100; i++) push(a, i * i); rt.put_n(len(a)); rt.put_c(' '); rt.put_n(cap(a)); rt.put_c(' '); rt.put_n(a[99]); rt.put_c(' '); rt.put_n(pop(a)); rt.put_c(' '); rt.put_n(len(a)); rt.put_c(' '); resize(a, 3); rt.put_n(len(a)); rt.put_c(' '); rt.put_n(a[2]); rt.put_c(' '); fixed int[?] f = rt.new(fixed int[?], 5); f[4] = 7; rt.put_n(f[4] + len(f)); rt.put_c(' '); point[?] ps = rt.new(point[?], 2); ps[1].y = 9; resize(ps, 10); rt.put_n(ps[1].y + len(ps)); rt.put_c(' '); int[8] st; rt.put_n(len(st)); rt.put_c(' '); point*[?] owned = rt.new(point*[?]); for (int i = 0; i < 20; i++) { point* p = rt.new(point); p.x = i; push(owned, d*p); } rt.put_n(owned[19].x); rt.put_c(' '); rt.put_n(rt.live_objects() - before); rt.put_c(10); } rt.put_n(rt.live_objects() - before); rt.put_c(10); return 0; }