MCPcopy Create free account
hub / github.com/Apress/beginning-cpp20 / push

Method push

Examples/NoModules/Chapter 17/Ex17_04/Stack.h:76–81  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 8

mainFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected