Mercurial > projects > ddmd
diff dmd/Array.d @ 84:be2ab491772e
Expressions -> Vector!Expression
author | Eldar Insafutdinov <e.insafutdinov@gmail.com> |
---|---|
date | Mon, 30 Aug 2010 16:12:19 +0100 |
parents | ad4792a1cfd6 |
children | 39648eb578f6 |
line wrap: on
line diff
--- a/dmd/Array.d Mon Aug 30 18:42:04 2010 +0400 +++ b/dmd/Array.d Mon Aug 30 16:12:19 2010 +0100 @@ -189,6 +189,11 @@ return _dim; } + @property final void dim(size_t newDim) + { + _dim = newDim; + } + @property final size_t length() const { return _dim; @@ -199,18 +204,18 @@ return _dim; } */ -/* + @property T *data() { return _data; } -*/ + @property final size_t allocdim() { return _allocdim; } - T opIndex(size_t index) + ref T opIndex(size_t index) { return _data[index]; } @@ -223,7 +228,7 @@ final T pop() { T v = _data[--_dim]; - _data[dim] = T.init; +// _data[dim] = T.init; return v; } @@ -270,6 +275,7 @@ } _dim = newdim; + // TODO if newdim < dim set memory to T.init } int opApply(scope int delegate(ref T) dg) @@ -302,6 +308,21 @@ insert(dim, a); } + final void remove(size_t i) + { + memmove(_data + i, _data + i + 1, (_dim - i) * T.sizeof); +// _data[dim-1] = T.init; + _dim--; + } + + final void insert(uint index, T ptr) + { + reserve(1); + memmove(_data + index + 1, _data + index, (_dim - index) * T.sizeof); + _data[index] = ptr; + _dim++; + } + final void insert(size_t index, Vector!T a) { if (a !is null) {