The analogue of "fill-pointer" in D

thedeemon via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon May 18 04:40:12 PDT 2015


On Monday, 18 May 2015 at 10:24:25 UTC, Dennis Ritchie wrote:

> No, afraid not. Function capacity is not an analogue of 
> fill-pointers!

It's exactly the same.

> Lisp-programmer explains the usefulness of fill-pointers as 
> follows:
>
> "Fill pointer "cuts" the tail of the vector.

In D: .length "cuts" the tail of the vector.

> For example, vector elements 100, but if you set the fill 
> pointer equal to 3, the length of the array (returned by 
> length) will be equal to 3. The remaining elements are not 
> visible.

In D: vector elements 100, but if you set the .length equal to
  3, the length of the array (returned by length) will be equal
  to 3. The remaining elements are not visible.

.capacity tells you "real" size of the buffer while .length is 
like that fill pointer.


More information about the Digitalmars-d-learn mailing list