4 typedef entity ArrayList;
8 #define AL_NEW(this, n, default, T) \
11 ArrayList _al = this = new(ArrayList); \
13 _al.al_buf = buf_create(); \
14 for (int i = 0, _n = _al.al_len = n; i < _n; ++i) \
16 const _AL_type__##T() it = default; \
17 AL_set##T(this, i, it); \
21 #define AL_DELETE(this) \
24 buf_del(this.al_buf); \
29 #define _AL_type__s() string
30 #define AL_gets(this, idx) bufstr_get(this.al_buf, idx)
31 #define AL_sets(this, idx, val) bufstr_set(this.al_buf, idx, val)
33 #define _AL_type__f() float
34 #define AL_getf(this, idx) stof(AL_gets(this, idx))
35 #define AL_setf(this, idx, val) AL_sets(this, idx, ftos(val))
37 #define _AL_type__e() entity
38 #define AL_gete(this, idx) ftoe(AL_getf(this, idx))
39 #define AL_sete(this, idx, val) AL_setf(this, idx, etof(val))
41 #define AL_EACH(this, T, cond, body) \
44 const noref ArrayList _al = this; \
45 for (int i = 0, n = _al.al_len; i < n; ++i) \
47 const noref _AL_type__##T() it = AL_get##T(_al, i); \