Pop an element from the stack (remove it from the stack and return it)
| 157 | |
| 158 | /// Pop an element from the stack (remove it from the stack and return it) |
| 159 | T pop() { |
| 160 | |
| 161 | assert(mNbElements > 0); |
| 162 | |
| 163 | mNbElements--; |
| 164 | |
| 165 | // Copy the item |
| 166 | T item = mArray[mNbElements]; |
| 167 | |
| 168 | // Call the destructor |
| 169 | mArray[mNbElements].~T(); |
| 170 | |
| 171 | return item; |
| 172 | } |
| 173 | |
| 174 | /// Return the top element of the stack |
| 175 | T& top() { |
no outgoing calls