Dynamic Arrays as Stack and/or Queue

IGotD- nise at nise.com
Mon Oct 7 19:16:31 UTC 2019


On Monday, 7 October 2019 at 17:36:09 UTC, Ferhat Kurtulmuş wrote:
>>
>> I'm not talking about memory deletion. I'm talking about push, 
>> pop, enqueue, and dequeue behavior. I'd assume in a garbage 
>> collected language letting the reference float off should be 
>> picked up by the GC.
> I'm sorry. Writing on my mobile phone. Maybe this is what you 
> are looking for
> https://dlang.org/phobos/std_container_dlist.html

I think what he is looking for are the general pop_front, 
push_front, pop_back and push_back that you would find in 
virtually any C++ STL container algorithms like list, vector or 
map.

I think this is a good question as I don't really see any good 
example in the documentation of the dynamic arrays about this. 
This is very common use case for arrays. Is there any D 
equivalent?


More information about the Digitalmars-d-learn mailing list