diff --git a/base/stl_add.hpp b/base/stl_add.hpp index 0a905fa190..d85a94b63a 100644 --- a/base/stl_add.hpp +++ b/base/stl_add.hpp @@ -111,9 +111,21 @@ struct DeleteFunctor } }; +template class DeleteRangeGuard +{ + TContainer & m_cont; +public: + DeleteRangeGuard(TContainer & cont) : m_cont(cont) {} + ~DeleteRangeGuard() + { + for_each(m_cont.begin(), m_cont.end(), DeleteFunctor()); + m_cont.clear(); + } +}; + struct NoopFunctor { - template inline void operator () (T const &) const + template void operator () (T const &) const { } };