| 73 | // Push an object onto the stack |
| 74 | template <typename T> |
| 75 | void Stack<T>::push(const T& item) |
| 76 | { |
| 77 | // See Chapter 18 for std::move() |
| 78 | auto node{ std::make_unique<Node>(item) }; // Create the new node |
| 79 | node->m_next = std::move(m_head); // Point to the old top node |
| 80 | m_head = std::move(node); // Make the new node the top |
| 81 | } |
| 82 | |
| 83 | // Pop an object off the stack |
| 84 | template <typename T> |