0

Is this possible? I need to read the data from a stack (and a queue), but I need to maintain the stack (and queue) so they can be used later.

I have not found any useful information online. My only thought is loading the data into a parallel stack before I pop through the original stack while I write out the data.

3
Contributors
4
Replies
5
Views
7 Years
Discussion Span
Last Post by firstPerson
1

If you are using std::stack, then there isn't any concept of iterators for std::stack, which makes sense.

As for your question, you can copy the stack content if needed. But it looks like you shouldn't be using stack in the first place?

0

I am using std::stack. I ended up copying the stack content. It is for an assignment. I think the point is to make us aware that this is a problem.

Thanks for confirming I would need to copy!

Edited by coolbeanbob: typo

0

I am using std::stack. I ended up copying the stack content. It is for an assignment. I think the point is to make us aware that this is a problem.

Thanks for confirming I would need to copy!

ok, cool beans then

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.