]> git.llucax.com Git - software/dgc/cdgc.git/blobdiff - rt/gc/cdgc/dynarray.d
Merge iface.d in gc.d
[software/dgc/cdgc.git] / rt / gc / cdgc / dynarray.d
index 2a36d9342123fb80569754b6ed7f19138f7d20f1..1995b7786ec7d428825e97e63b0b7dd62350597e 100644 (file)
@@ -79,6 +79,14 @@ public:
         return this._capacity;
     }
 
+    /**
+     * Get the total ammount of bytes the elements consumes (capacity included).
+     */
+    size_t elements_sizeof()
+    {
+        return this._capacity * (T.sizeof + (T*).sizeof);
+    }
+
     /**
      * Get the pointer to the array's data.
      *
@@ -190,7 +198,7 @@ public:
         if (new_capacity == 0)
             new_capacity = this._size * 2;
             if (new_capacity == 0)
-                new_capacity = 4;
+                new_capacity = 16;
         // reallocate the memory with the new_capacity
         T* new_data = cast(T*) realloc(this._data, new_capacity * T.sizeof);
         if (new_data is null)