resizeable arrays: T[new]

Walter Bright newshound1 at digitalmars.com
Mon Jun 4 12:56:52 PDT 2007


BCS wrote:
> Walter Bright wrote:
>> Derek Parnell wrote:
>>> On Mon, 04 Jun 2007 02:33:58 -0700, Walter Bright wrote:
>>>>     b = c;          // ok, implicit conversion of resizeable to dynamic
>>>
>>>
>>> But hang on, you said that b.length isn't allowed to change? Or did you
>>> mean that it can only change if b.ptr also being updated?
>>
>>
>> I meant that the underlying array cannot be resized through b. b 
>> itself can have its ptr/length values changed through simple 
>> assignment, but there will be no realloc happening.
>>
> 
> so with T[n], .length (all by it's self) is a compile time const, with 
> T[] it is an r-value and with T[new] it is an l-value. Is that more or 
> less the sum of it?

Yes.



More information about the Digitalmars-d-announce mailing list