pointers, assignments, Garbage Collection Oh My?

Sean Kelly sean at invisibleduck.org
Wed Jul 10 11:10:46 PDT 2013


On Jul 10, 2013, at 10:45 AM, Namespace <rswhite4 at googlemail.com> wrote:

>> A string in D, and all arrays, is a struct looking like this:
>> 
>> struct Array (T)
>> {
>>    T* ptr;
>>    size_t length;
>> }
> 
> I always thought it looks like this:
> 
> struct Array(T) {
>    T* ptr;
>    size_t length, capacity;
> }

Sadly, no.  The only way to determine the capacity of an array is to query the GC.


More information about the Digitalmars-d-learn mailing list