Does the std::stack in the C++ STL expose any iterators of the underlying container or should I use that container directly?
Does the std::stack in the C++ STL expose any iterators of the underlying container
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Stack does not have iterators, by definition of stack. If you need stack with iterators, you’ll need to implement it yourself on top of other container (std::list, std::vector, etc). Stack doc is here.
P.S. According to a comment i got from Iraimbilanja, std::stack by default uses std::deque for implementation.