Disjoint slices of an array as reference

Ali Çehreli acehreli at yahoo.com
Thu Aug 20 08:10:48 UTC 2020


On 8/19/20 7:40 PM, data pulverizer wrote:

 > An array in D is either two pointers or one pointer and a length (I
 > don't know which)

It is the length, followed by the pointer, equivalent of the following 
struct:

struct A {
   size_t length_;
   void * ptr;

   size_t length() {
     return length_;
   }

   size_t length(size_t newLength) {
     // Modify length_ and ptr as necessary
   }
}

Ali



More information about the Digitalmars-d-learn mailing list