For stack pop()
is void, which means I need two lines of code whenever I want to get the top and pop:
auto top = s.top();
s.pop();
It would be convenient if I could just do:
auto top = s.pop();
Why is it like this?
For stack pop()
is void, which means I need two lines of code whenever I want to get the top and pop:
auto top = s.top();
s.pop();
It would be convenient if I could just do:
auto top = s.pop();
Why is it like this?