I know that stack/queue is container adaptor that use deque as its default underlying container. But why the hassle when we can just use deque as a stack or a queue? And I don't see the situations where we have to use stack/queue with different underlying containers other than deque either. Besides, does a stack/queue (with underlying deque) cost a bit more memory than a deque? (the data structure is more complex so it has to do, right?). If so, then is the difference big if the data is huge?
Edit: Why was this question marked as duplicate and was linked to c++ deque vs queue vs stack ? I didn't ask the difference between deque and queue (as I've already known). I asked why not use a deque as a stack/queue instead of using the class stack/queue, and some other questions regarding memory consumption.