On Sunday, 19 February 2017 at 11:41:44 UTC, Eugene Wissner wrote:
realloc() can move memory and if an object of type A has references to other objects in the array, the objects will be corrupted. "A" should be a POD-type. Otherwise you have to allocate new memory, initialize it, copy the objects by one and deallocate the old memory. Now there is IAllocator.expand().
What's the difference between realloc+postblit and copy one by one? Postblit is called only after copy, it's not a constructor.