Discussion about this post

User's avatar
Yacob Cohen-Arazi's avatar

Yes. Good point and this what I do. Never understood why the design choice of deque.

Expand full comment
Nicolas's avatar

Interesting fact to be recalled !

Was your intent only to populate the stack ?

Because as Yooseong said, by doing op_pop = 1 + checking if stack is empty before top() an pop() I observed reversed results.

In fact deque versatility may be overlooked. I often see in code non-reserved vector which feel like some kind of laziness or unconsciousness.

My favorite link on SO: https://stackoverflow.com/questions/6292332/what-really-is-a-deque-in-stl

Expand full comment
4 more comments...

No posts