Dynamic Arrays as Stack and/or Queue

Just Dave abcdef at 1234.com
Mon Oct 7 17:11:08 UTC 2019


I need a stack and a queue and I noticed that the standard 
library doesn't appear to have one. Which is ok. I just need 
something that can logically behave as a stack and queue, which I 
think the dynamic array should be able to do (if I understand 
correctly this is effectively the equivalent of vector<T> in C++ 
or List<T> in C#). However, I'm having a hard time figuring out 
the best way to push, pop, enqueue and dequeue using D.

I'm not seeing here: https://dlang.org/spec/arrays.html, anyway 
to remove from the array. What's the correct syntax/method call 
for this? I see you can easily concatenate with '~', but I see no 
corresponding delete.

Sorry for the newbie question, but I'm just unsure where to look 
for this.


More information about the Digitalmars-d-learn mailing list