mirror of
https://github.com/libretro/bnes-libretro.git
synced 2024-11-23 08:19:43 +00:00
27 lines
624 B
C++
27 lines
624 B
C++
#ifndef NALL_STACK_HPP
|
|
#define NALL_STACK_HPP
|
|
|
|
#include <nall/vector.hpp>
|
|
|
|
namespace nall {
|
|
template<typename T> struct stack : public linear_vector<T> {
|
|
void push(const T &value) {
|
|
linear_vector<T>::append(value);
|
|
}
|
|
|
|
T pull() {
|
|
if(linear_vector<T>::size() == 0) throw;
|
|
T value = linear_vector<T>::operator[](linear_vector<T>::size() - 1);
|
|
linear_vector<T>::remove(linear_vector<T>::size() - 1);
|
|
return value;
|
|
}
|
|
|
|
T& operator()() {
|
|
if(linear_vector<T>::size() == 0) throw;
|
|
return linear_vector<T>::operator[](linear_vector<T>::size() - 1);
|
|
}
|
|
};
|
|
}
|
|
|
|
#endif
|