Listing 7
template<typename T> struct StackImpl { typedef typename std::vector<T>::iterator Iterator; typedef T Item; Iterator Begin() { return m.begin(); } Iterator End() { return m.end(); } void push(T n) { m.push_back(n); } T pop() { T ret = m.back(); m.pop_back(); return ret; } private: std::vector<T> m; }; template<typename T> struct Stack : IterableExtension<StackImpl<T> > { };