Both act like a stack. Both have push and pop operations.
Is the difference in some memory layouts?
stack
is a stack. It can only push and pop. A vector
can do other things, like insert into the middle. This increases flexibility, but reduces guarantees.
For example, for a stack, if you push A then B onto the back then you are guaranteed that they will be removed in the order B, then A. vector
doesn't guarantee that.