Nick Sabalausky:

> https://www.semitwist.com/articles/article/view/don-t-use-arrays-as-stacks

Is it possible to write a function like:

ForeachType!A unsafePop(A)(A)if(isDynamicArray!A) { /*...*/ }

that contains both the popping (and something like assumeSafeAppend to mess 
with the druntime data structures) and use it to allow a stack-like usage of D 
dynamic arrays? (This function is not meant to replace the usage of a proper 
stack data structure based on a deque when you need a heavy-duty stack, but 
it's handy in other lighter cases).

Bye,
bearophile

Reply via email to