If T[new] is the container for T[], then what is the container for T[U]?

Robert Jacques sandford at jhu.edu
Sat Apr 25 09:46:37 PDT 2009


On Sat, 25 Apr 2009 09:16:39 -0400, Andrei Alexandrescu  
<SeeWebsiteForEmail at erdani.org> wrote:

> Stewart Gordon wrote:
>> Andrei Alexandrescu wrote:
>>> It looks we can't make it with only T[]. We need a genuine container  
>>> type, and T[new] was suggested.
>> <snip>
>>  What do you mean by a "genuine container type"?
>
> One with capacity and probably value semantics.
>
> Andrei

If you add capacity to arrays, why do need seperate slice and container  
types?
i.e.
.capacity  > 0 -> container
.capacity == 0 -> slice

Note: this use of a capacity field has been mentioned before.



More information about the Digitalmars-d mailing list