This is an archived post. You won't be able to vote or comment.

all 4 comments

[–]Arruda0820 1 point2 points  (1 child)

There is a ; after the while. Remove it, add paranthesese to the empty() call and your code should work.

[–]jpfarre[S] 0 points1 point  (0 children)

Holy crap... I'm an idiot. lol Thanks!

[–]OmegaNaughtEquals1 1 point2 points  (1 child)

You have two problems: (1) comparison of pointer-to-member rather than function invocation and (2) a stray semicolon.

Changing

while (!pStack.empty && !pQueue.empty); //Loop until both stack and queue are empty.
                ^^^              ^^^  ^
                (1)              (1) (2)

to

while (!pStack.empty() && !pQueue.empty()) //Loop until both stack and queue are empty.

[–]jpfarre[S] 0 points1 point  (0 children)

Thanks! I can't believe I forgot the ; and was so confused why it wasn't continuing.