Quick background
I\'m a Java developer who\'s been playing around with C++ in my free/bored time.
Preface
In C++, you often see
Using C++0x makes the whole thing hard again.
As
stack.pop(item); // move top data to item without copying
makes it possible to efficiently move the top element from the stack. Whereas
item = stack.top(); // make a copy of the top element
stack.pop(); // delete top element
doesn't allow such optimizations.