diff options
author | Santo Cariotti <dcariotti24@gmail.com> | 2020-05-24 15:45:44 +0200 |
---|---|---|
committer | Santo Cariotti <dcariotti24@gmail.com> | 2020-05-24 15:45:44 +0200 |
commit | f04e3a465b28b921f89695ca4743ac8b439b17f1 (patch) | |
tree | eb31e7d58b6f150562499b831073b6a656eacef3 /I_anno/Programmazione_2/data_structures/stack.cc | |
parent | d58e4f1ff807fc7ef321495ed6e231ea798102d5 (diff) |
fix: queue and stack push/pop
Diffstat (limited to 'I_anno/Programmazione_2/data_structures/stack.cc')
-rw-r--r-- | I_anno/Programmazione_2/data_structures/stack.cc | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/I_anno/Programmazione_2/data_structures/stack.cc b/I_anno/Programmazione_2/data_structures/stack.cc index f1cc7d1..ffff780 100644 --- a/I_anno/Programmazione_2/data_structures/stack.cc +++ b/I_anno/Programmazione_2/data_structures/stack.cc @@ -34,12 +34,11 @@ public: node<T>* pop() { if(!_head) return nullptr; - - auto old_head = _head; + node<T>* elem = _head; delete _head; - _head = _head->next; + _head = elem->next; - return old_head; + return elem; } void print() { |