How do you deal with scoped allocations?

Adam D. Ruppe destructionator at gmail.com
Sat Dec 7 15:21:04 PST 2013


On Saturday, 7 December 2013 at 22:32:59 UTC, Namespace wrote:
> Since D doesn't offer VLA's and alloca is broken (besides the 
> ugly syntax),
> I use a scoped wrapper (since scope doesn't do the job):

I like to use a helper template that defines a static array with 
a typical size. Then, if the runtime requirement is less than 
that, it can simply slice into the static array, and if not, then 
do the alloc/free pair.


More information about the Digitalmars-d mailing list