#pragma once #ifndef PTR_STACK_H_62B23520_7C8E_11DE_8A39_0800200C9A66 #define PTR_STACK_H_62B23520_7C8E_11DE_8A39_0800200C9A66 #include #include template class ptr_stack { public: ptr_stack() {} ~ptr_stack() { clear(); } void clear() { for(unsigned i=0;i t) { m_data.push_back(t.release()); } std::auto_ptr pop() { std::auto_ptr t(m_data.back()); m_data.pop_back(); return t; } T& top() { return *m_data.back(); } private: std::vector m_data; }; #endif // PTR_STACK_H_62B23520_7C8E_11DE_8A39_0800200C9A66