diff options
Diffstat (limited to 'src/utils')
-rw-r--r-- | src/utils/dtor.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/utils/dtor.h b/src/utils/dtor.h index f7c790c6..9aa92c84 100644 --- a/src/utils/dtor.h +++ b/src/utils/dtor.h @@ -22,6 +22,7 @@ #ifndef _TMW_UTILS_DTOR_H #define _TMW_UTILS_DTOR_H +#include <algorithm> #include <functional> #include <utility> @@ -44,4 +45,10 @@ inline dtor<typename Cont::value_type> make_dtor(Cont const&) return dtor<typename Cont::value_type>(); } +template<typename Container> +inline void delete_all(Container &c) +{ + std::for_each(c.begin(), c.end(), make_dtor(c)); +} + #endif |