X-Git-Url: https://git.saurik.com/cycript.git/blobdiff_plain/953e82542e98bebaeab20e56507f941c877cefe9..a664a58af473f46e9a20aa62b8ec938fd6ccf81a:/Stack.hpp?ds=inline diff --git a/Stack.hpp b/Stack.hpp index c04afb1..3f82078 100644 --- a/Stack.hpp +++ b/Stack.hpp @@ -24,6 +24,63 @@ namespace cy { +#if 0 +template +class stack { + public: + typedef std::vector Data_; + typedef typename Data_::const_reverse_iterator const_iterator; + + private: + Data_ data_; + + public: + stack() { + data_.reserve(200); + } + + _finline Type_ &operator [](size_t i) { + return data_[data_.size() - 1 - i]; + } + + _finline const Type_ &operator [](size_t i) const { + return data_[data_.size() - 1 - i]; + } + + _finline void push(Type_ &t) { + data_.push_back(t); + } + + _finline void pop() { + data_.pop_back(); + } + + _finline void pop(unsigned int size) { + for (; size != 0; --size) + pop(); + } + + void clear() { + data_.clear(); + } + + _finline size_t size() const { + return data_.size(); + } + + _finline const_iterator begin() const { + return data_.rbegin(); + } + + _finline const_iterator end() const { + return data_.rend(); + } + + private: + stack(const stack &); + stack &operator =(const stack &); +}; +#else template class stack { public: @@ -120,6 +177,7 @@ class stack { stack(const stack &); stack &operator =(const stack &); }; +#endif template > class slice {