I've been developing my own stack implementation. data is my main storage mechanism:
Code:
template<class T> class Stack
{
private:
	T *data;
public:
                typedef T* iter;
I've supplied all the functionality I need for the stack except for a class iterator to loop through the stack's values. I'm looking to do something like this:
Code:
Stack<int> s;
s.push(1);
s.push(2);
s.push(4);
for(Stack<int>::iter it=s.begin();it!=s.end();it++)
     cout << *it << endl;
What should I have the begin() and end() functions return? An iterator is basically a pointer to the stack data right? I'm stuck.
Code:
inline iter begin()
{
     iter front= ... //????
     return front;
}
Am I on the right track?