You're right of course that std::stack API is too limited.

I'm not sure who told you to use `std::list`, but it has to do a small memory allocation and store a next and previous pointer for each entry. This is definitely less efficient that an `std::vector`, which stores the entries in a single block of memory (of course it may need to resize it once in a while) and has zero overhead per item. Iterating over elements in a std::vector is also more efficient due to the locality of the data. So, the rule of thumb should be that if you're not doing anything for which a `std::vector` is not suitable, you should use a `std::vector`.