// © Copyright 1997. Joseph Bergin. All rights reserved.#ifndef __ArrayStack__#define __ArrayStack__template <class T> class ArrayStackIterator;template <class T>class ArrayStack{	public:		typedef ArrayStackIterator<T> iterator;				ArrayStack(int size = 100)		:	_size(size), 			_top(-1),			_elements(new T[size])		{		}				~ArrayStack(){ delete _elements; }				void push(const T& v){ _elements[++_top] = v; }				T pop(){ return _elements[_top--]; }				T top(){ return _elements[_top]; }		bool empty(){ return _top < 0; }				bool full(){ return _top >= _size; }				iterator begin()		{	return ArrayStackIterator<T>(_elements, 0);		}				iterator end()		{	return ArrayStackIterator<T>(_elements, _top+1);		}			private:		int _size;		int _top;		T* _elements;	friend class ArrayStackIterator<T>;};template <class T>class ArrayStackIterator{	public:		typedef T value_type;		T& operator*()		{	return _array[_where];		}				bool operator<(const ArrayStackIterator<T>& i){ return _where < i._where; }				ArrayStackIterator<T> operator+(int i)		{	return ArrayStackIterator<T>(_array, _where + i); 		}				T& operator++(){ return _array[++_where];}		T& operator++(int) {return _array[_where++];}			private:		ArrayStackIterator(T* s, int where = 0)		:	_where(where),			_array(s)		{		}				int	_where;		T* _array;	friend class ArrayStack<T>;};#endif