annotate dmd/Array.d @ 94:3a0b150c9841

Objects -> Vector!Object iteration 1
author Eldar Insafutdinov <e.insafutdinov@gmail.com>
date Mon, 30 Aug 2010 23:00:34 +0100
parents 39648eb578f6
children 3482c73a991b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
1 module dmd.Array;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
2
4
d706d958e4e8 Step 2 of restoring GC functionality.
korDen
parents: 2
diff changeset
3 import core.memory;
2
7427ded8caf7 Removed unreferenced modules
korDen
parents: 0
diff changeset
4
34
544b922227c7 update to work with dmd 2.048
korDen
parents: 4
diff changeset
5 import std.exception;
2
7427ded8caf7 Removed unreferenced modules
korDen
parents: 0
diff changeset
6 import core.stdc.string;
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
7 import core.stdc.stdlib;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
8
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
9 class Array
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
10 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
11 uint dim = 0;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
12 uint allocdim = 0;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
13 void** data = null;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
14
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
15 ~this()
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
16 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
17 ///mem.free(data);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
18 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
19
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
20 void mark()
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
21 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
22 ///unsigned u;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
23 ///mem.mark(data);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
24 ///for (u = 0; u < dim; u++)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
25 ///mem.mark(data[u]); // BUG: what if arrays of Object's?
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
26 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
27
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 34
diff changeset
28 override string toString()
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
29 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
30 char *p;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
31
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
32 ///char **buf = cast(char**)alloca(dim * (char*).sizeof);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
33 scope string[] buf = new string[dim];
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
34 uint len = 2;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
35 for (uint u = 0; u < dim; u++) {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
36 buf[u] = (cast(Object)data[u]).toString();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
37 len += buf[u].length + 1;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
38 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
39
2
7427ded8caf7 Removed unreferenced modules
korDen
parents: 0
diff changeset
40 char* str = cast(char*)GC.malloc(len);
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
41
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
42 str[0] = '[';
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
43 p = str + 1;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
44
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
45 for (uint u = 0; u < dim; u++)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
46 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
47 if (u != 0) {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
48 *p++ = ',';
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
49 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
50 uint length = buf[u].length;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
51 p[0..length] = buf[u][];
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
52
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
53 p += length;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
54 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
55
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
56 *p++ = ']';
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
57 *p = 0;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
58
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
59 return assumeUnique(str[0..len]);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
60 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
61
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
62 final void reserve(uint nentries)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
63 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
64 //printf("Array::reserve: size = %d, offset = %d, nbytes = %d\n", size, offset, nbytes);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
65 if (allocdim - dim < nentries) {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
66 allocdim = dim + nentries;
2
7427ded8caf7 Removed unreferenced modules
korDen
parents: 0
diff changeset
67 data = cast(void**)GC.realloc(data, allocdim * (*data).sizeof);
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
68 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
69 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
70
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
71 final void setDim(uint newdim)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
72 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
73 if (dim < newdim) {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
74 reserve(newdim - dim);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
75 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
76
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
77 dim = newdim;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
78 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
79
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
80 final void fixDim()
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
81 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
82 if (dim != allocdim)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
83 {
2
7427ded8caf7 Removed unreferenced modules
korDen
parents: 0
diff changeset
84 data = cast(void**)GC.realloc(data, dim * (*data).sizeof);
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
85 allocdim = dim;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
86 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
87 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
88
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
89 final void push(void* ptr)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
90 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
91 reserve(1);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
92 data[dim++] = ptr;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
93 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
94
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
95 final void* pop()
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
96 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
97 return data[--dim];
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
98 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
99
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
100 final void shift(void* ptr)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
101 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
102 reserve(1);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
103 memmove(data + 1, data, dim * (*data).sizeof);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
104 data[0] = ptr;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
105 dim++;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
106 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
107
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
108 final void insert(uint index, void* ptr)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
109 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
110 reserve(1);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
111 memmove(data + index + 1, data + index, (dim - index) * (*data).sizeof);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
112 data[index] = ptr;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
113 dim++;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
114 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
115
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
116 final void insert(uint index, Array a)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
117 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
118 if (a !is null) {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
119 uint d = a.dim;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
120 reserve(d);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
121
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
122 if (dim != index) {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
123 memmove(data + index + d, data + index, (dim - index) * (*data).sizeof);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
124 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
125
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
126 memcpy(data + index, a.data, d * (*data).sizeof);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
127 dim += d;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
128 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
129 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
130
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
131 /***********************************
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
132 * Append array a to this array.
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
133 */
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
134 final void append(Array a)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
135 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
136 insert(dim, a);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
137 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
138
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
139 final void remove(uint i)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
140 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
141 memmove(data + i, data + i + 1, (dim - i) * (*data).sizeof);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
142 dim--;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
143 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
144
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
145 final void zero()
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
146 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
147 memset(data, 0, dim * (*data).sizeof);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
148 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
149
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
150 final void* tos()
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
151 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
152 return dim ? data[dim - 1] : null;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
153 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
154
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
155 private static extern (C) int Array_sort_compare(const(void*) x, const(void*) y)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
156 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
157 Object ox = *cast(Object *)x;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
158 Object oy = *cast(Object *)y;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
159
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
160 return ox.opCmp(oy);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
161 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
162
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
163 final void sort()
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
164 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
165 if (dim) {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
166 qsort(cast(void*)data, dim, Object.sizeof, &Array_sort_compare);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
167 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
168 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
169
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
170 final Array copyTo(Array a)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
171 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
172 a.setDim(dim);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
173 memcpy(a.data, data, dim * (*data).sizeof);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
174
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
175 return a;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
176 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
177
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
178 final Array copy()
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
179 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
180 return copyTo(new Array());
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
181 }
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 34
diff changeset
182 }
74
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
183
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
184 class Vector(T)
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
185 {
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
186 public:
77
ad4792a1cfd6 more D-ification container accessing
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 74
diff changeset
187 @property final size_t dim()
74
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
188 {
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
189 return _dim;
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
190 }
77
ad4792a1cfd6 more D-ification container accessing
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 74
diff changeset
191
84
be2ab491772e Expressions -> Vector!Expression
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 77
diff changeset
192 @property final void dim(size_t newDim)
be2ab491772e Expressions -> Vector!Expression
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 77
diff changeset
193 {
be2ab491772e Expressions -> Vector!Expression
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 77
diff changeset
194 _dim = newDim;
be2ab491772e Expressions -> Vector!Expression
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 77
diff changeset
195 }
be2ab491772e Expressions -> Vector!Expression
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 77
diff changeset
196
77
ad4792a1cfd6 more D-ification container accessing
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 74
diff changeset
197 @property final size_t length() const
ad4792a1cfd6 more D-ification container accessing
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 74
diff changeset
198 {
ad4792a1cfd6 more D-ification container accessing
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 74
diff changeset
199 return _dim;
ad4792a1cfd6 more D-ification container accessing
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 74
diff changeset
200 }
ad4792a1cfd6 more D-ification container accessing
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 74
diff changeset
201 /* Doesn't work due to compiler BUG
ad4792a1cfd6 more D-ification container accessing
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 74
diff changeset
202 @property final size_t opDollar() const
ad4792a1cfd6 more D-ification container accessing
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 74
diff changeset
203 {
ad4792a1cfd6 more D-ification container accessing
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 74
diff changeset
204 return _dim;
ad4792a1cfd6 more D-ification container accessing
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 74
diff changeset
205 }
ad4792a1cfd6 more D-ification container accessing
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 74
diff changeset
206 */
84
be2ab491772e Expressions -> Vector!Expression
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 77
diff changeset
207
74
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
208 @property T *data()
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
209 {
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
210 return _data;
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
211 }
84
be2ab491772e Expressions -> Vector!Expression
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 77
diff changeset
212
90
39648eb578f6 more Expressions work
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 84
diff changeset
213
39648eb578f6 more Expressions work
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 84
diff changeset
214
39648eb578f6 more Expressions work
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 84
diff changeset
215 @property T *ptr()
39648eb578f6 more Expressions work
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 84
diff changeset
216 {
39648eb578f6 more Expressions work
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 84
diff changeset
217 return _data;
39648eb578f6 more Expressions work
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 84
diff changeset
218 }
39648eb578f6 more Expressions work
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 84
diff changeset
219
77
ad4792a1cfd6 more D-ification container accessing
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 74
diff changeset
220 @property final size_t allocdim()
74
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
221 {
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
222 return _allocdim;
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
223 }
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
224
84
be2ab491772e Expressions -> Vector!Expression
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 77
diff changeset
225 ref T opIndex(size_t index)
74
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
226 {
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
227 return _data[index];
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
228 }
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
229
77
ad4792a1cfd6 more D-ification container accessing
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 74
diff changeset
230 void opIndexAssign(T value, size_t index)
74
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
231 {
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
232 _data[index] = value;
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
233 }
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
234
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
235 final T pop()
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
236 {
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
237 T v = _data[--_dim];
84
be2ab491772e Expressions -> Vector!Expression
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 77
diff changeset
238 // _data[dim] = T.init;
74
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
239 return v;
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
240 }
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
241
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
242 final void push(T elem)
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
243 {
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
244 reserve(1);
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
245 _data[_dim++] = elem;
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
246 }
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
247
94
3a0b150c9841 Objects -> Vector!Object iteration 1
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 90
diff changeset
248 final void zero()
3a0b150c9841 Objects -> Vector!Object iteration 1
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 90
diff changeset
249 {
3a0b150c9841 Objects -> Vector!Object iteration 1
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 90
diff changeset
250 memset(_data, 0, dim * T.sizeof);
3a0b150c9841 Objects -> Vector!Object iteration 1
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 90
diff changeset
251 // TODO fix to assign T.init
3a0b150c9841 Objects -> Vector!Object iteration 1
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 90
diff changeset
252 }
3a0b150c9841 Objects -> Vector!Object iteration 1
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 90
diff changeset
253
77
ad4792a1cfd6 more D-ification container accessing
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 74
diff changeset
254 final void reserve(size_t nentries)
74
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
255 {
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
256 //printf("Array::reserve: size = %d, offset = %d, nbytes = %d\n", size, offset, nbytes);
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
257 if (allocdim - dim < nentries) {
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
258 _allocdim = dim + nentries;
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
259 _data = cast(T*)GC.realloc(_data, allocdim * T.sizeof);
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
260 }
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
261 }
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
262
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
263 final void shift(T ptr)
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
264 {
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
265 reserve(1);
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
266 memmove(_data + 1, _data, _dim * T.sizeof);
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
267 _data[0] = ptr;
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
268 _dim++;
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
269 }
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
270
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
271 final Vector!T copy()
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
272 {
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
273 return copyTo(new Vector!T());
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
274 }
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
275
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
276 final Vector!T copyTo(Vector!T a)
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
277 {
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
278 a.setDim(dim);
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
279 memcpy(a._data, _data, dim * T.sizeof);
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
280 // TODO call postblits
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
281 return a;
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
282 }
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
283
77
ad4792a1cfd6 more D-ification container accessing
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 74
diff changeset
284 final void setDim(size_t newdim)
74
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
285 {
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
286 if (dim < newdim) {
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
287 reserve(newdim - dim);
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
288 }
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
289
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
290 _dim = newdim;
84
be2ab491772e Expressions -> Vector!Expression
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 77
diff changeset
291 // TODO if newdim < dim set memory to T.init
74
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
292 }
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
293
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
294 int opApply(scope int delegate(ref T) dg)
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
295 {
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
296 int result = 0;
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
297
77
ad4792a1cfd6 more D-ification container accessing
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 74
diff changeset
298 for (size_t i = 0; i < _dim; i++)
74
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
299 {
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
300 result = dg(_data[i]);
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
301 if (result)
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
302 break;
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
303 }
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
304 return result;
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
305 }
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
306
77
ad4792a1cfd6 more D-ification container accessing
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 74
diff changeset
307 int opApply(scope int delegate(ref size_t key, ref T value) dg)
74
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
308 {
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
309 int result = 0;
77
ad4792a1cfd6 more D-ification container accessing
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 74
diff changeset
310 for (size_t i = 0; i < _dim; i++)
74
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
311 {
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
312 result = dg(i, _data[i]);
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
313 if(result)
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
314 break;
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
315 }
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
316 return result;
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
317 }
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
318
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
319 final void append(Vector!T a)
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
320 {
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
321 insert(dim, a);
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
322 }
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
323
84
be2ab491772e Expressions -> Vector!Expression
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 77
diff changeset
324 final void remove(size_t i)
be2ab491772e Expressions -> Vector!Expression
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 77
diff changeset
325 {
be2ab491772e Expressions -> Vector!Expression
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 77
diff changeset
326 memmove(_data + i, _data + i + 1, (_dim - i) * T.sizeof);
be2ab491772e Expressions -> Vector!Expression
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 77
diff changeset
327 // _data[dim-1] = T.init;
be2ab491772e Expressions -> Vector!Expression
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 77
diff changeset
328 _dim--;
be2ab491772e Expressions -> Vector!Expression
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 77
diff changeset
329 }
be2ab491772e Expressions -> Vector!Expression
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 77
diff changeset
330
be2ab491772e Expressions -> Vector!Expression
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 77
diff changeset
331 final void insert(uint index, T ptr)
be2ab491772e Expressions -> Vector!Expression
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 77
diff changeset
332 {
be2ab491772e Expressions -> Vector!Expression
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 77
diff changeset
333 reserve(1);
be2ab491772e Expressions -> Vector!Expression
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 77
diff changeset
334 memmove(_data + index + 1, _data + index, (_dim - index) * T.sizeof);
be2ab491772e Expressions -> Vector!Expression
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 77
diff changeset
335 _data[index] = ptr;
be2ab491772e Expressions -> Vector!Expression
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 77
diff changeset
336 _dim++;
be2ab491772e Expressions -> Vector!Expression
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 77
diff changeset
337 }
be2ab491772e Expressions -> Vector!Expression
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 77
diff changeset
338
77
ad4792a1cfd6 more D-ification container accessing
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 74
diff changeset
339 final void insert(size_t index, Vector!T a)
74
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
340 {
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
341 if (a !is null) {
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
342 uint d = a.dim;
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
343 reserve(d);
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
344
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
345 if (dim != index) {
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
346 memmove(_data + index + d, _data + index, (dim - index) * T.sizeof);
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
347 }
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
348
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
349 memcpy(_data + index, a._data, d * T.sizeof);
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
350 _dim += d;
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
351 }
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
352 }
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
353 private:
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
354 T* _data = null;
77
ad4792a1cfd6 more D-ification container accessing
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 74
diff changeset
355 size_t _dim = 0;
ad4792a1cfd6 more D-ification container accessing
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 74
diff changeset
356 size_t _allocdim = 0;
74
7e0d548de9e6 Switch Arrays of Dsymbols to the new templated Vector type
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 72
diff changeset
357 }