bearophile wrote:
davidl:
Something like following can substitute dynamic array:
struct da(T){
     T* ptr;
     int len, capacity;
     T opIndex(int i){}
...

On 32 bit systems that struct is 3*4 bytes long, but the current GC allocates small sizes 
using blocks of memory long as powers of 2, so I think that struct uses 4*4 bytes anyway. 
So the 4th word can be used for something else. A good way to use it may be to store 
there a hash value (by default is 0, that means "hash not computed yet").

Aren't arrays manipulated mostly by value?

Andrei

Reply via email to