4 typedef entity ArrayList;
8 #define AL_NEW(this, n, default, T) \
11 ArrayList _al = this = new_pure(ArrayList); \
12 _al.al_buf = buf_create(); \
13 for (int i = 0, _n = _al.al_len = n; i < _n; ++i) \
15 const _AL_type__##T() it = default; \
16 AL_set##T(this, i, it); \
20 #define AL_DELETE(this) \
23 buf_del(this.al_buf); \
28 #define _AL_type__s() string
29 #define AL_gets(this, idx) bufstr_get(this.al_buf, idx)
30 #define AL_sets(this, idx, val) bufstr_set(this.al_buf, idx, val)
33 string al_ftos(float f) = #26;
34 float al_stof(string s) = #81;
36 string al_ftos(float f) = #26;
37 float al_stof(string s) = #81;
39 string al_ftos(float f) = #17;
40 float al_stof(string s) = #21;
43 #define _AL_type__f() float
44 #define AL_getf(this, idx) al_stof(AL_gets(this, idx))
45 #define AL_setf(this, idx, val) AL_sets(this, idx, al_ftos(val))
48 int al_etof(entity e) = #512;
49 entity al_ftoe(int i) = #459;
51 int al_etof(entity e) = #512;
52 entity al_ftoe(int i) = #459;
54 int al_etof(entity e) = #79;
55 entity al_ftoe(int i) = #80;
58 #define _AL_type__e() entity
59 #define AL_gete(this, idx) al_ftoe(AL_getf(this, idx))
60 #define AL_sete(this, idx, val) AL_setf(this, idx, al_etof(val))
62 #define AL_EACH(this, T, cond, body) \
65 const noref ArrayList _al = this; \
66 for (int i = 0, n = _al.al_len; i < n; ++i) \
68 const noref _AL_type__##T() it = AL_get##T(_al, i); \