Question about Walter's Memory DisAllocation pattern

thedeemon via Digitalmars-d digitalmars-d at puremagic.com
Fri Jun 26 21:57:27 PDT 2015


On Saturday, 27 June 2015 at 02:51:18 UTC, Parke wrote:

> In the above example, buf's length is uint.sizeof * 3.  But 
> what if buf's length was a function of u (and therefore only 
> known at run-time), rather than a function of uint.sizeof?

In this case you have two options:
1) do not store result in a buffer but calculate data in the 
range methods (front() and popFront())
2) allocate and give up this disallocation pattern


More information about the Digitalmars-d mailing list