diff options
Diffstat (limited to 'src/utils')
-rw-r--r-- | src/utils/dtor.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/utils/dtor.h b/src/utils/dtor.h index 3b8aeb0e..29cde178 100644 --- a/src/utils/dtor.h +++ b/src/utils/dtor.h @@ -24,6 +24,7 @@ #ifndef _TMW_UTILS_DTOR_H #define _TMW_UTILS_DTOR_H +#include <algorithm> #include <functional> #include <utility> @@ -46,4 +47,11 @@ 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 |