Re: Single-Allocation Variable-Sized Array

2016-05-21 Thread Nordlöw via Digitalmars-d-learn
On Wednesday, 18 May 2016 at 23:45:07 UTC, Alex Parrill wrote: In C it's called a variable-length struct or object. I don't think D implements them, but this could probably work: Thanks!

Re: Single-Allocation Variable-Sized Array

2016-05-18 Thread Alex Parrill via Digitalmars-d-learn
On Wednesday, 18 May 2016 at 21:28:56 UTC, Nordlöw wrote: What's the preferred way in D to implement single-allocation variable-sized arrays such as /** Single-Allocation Array. */ struct ArrayN { ubyte length; // <= maxLength size room; // allocated length ubyte[0] data; //