On 05/30/2010 05:32 PM, Simen kjaeraas wrote:
Rainer Deyke <rain...@eldwood.com> wrote:

Any container that supports pushing and popping on one end can be used
as a stack. Any container that supports pushing on one end and popping
on the other can be used as a queue. I don't think either of these need
their own container type.

There are other concerns than simply what works. First of all is
readability - having containers called queue and stack makes code easier
to understand, even if this is done with a simple alias.
There might also be a concern about efficiency, as there is a difference
in how fast different containers can push and pop.

std.container is designed to provide operations only within strict complexity limits. So if something offers insertFront and removeFront or insertBack and removeBack, it should be usable as a stack.

Andrei

Reply via email to