From ef0fecc856d435ff140ce87ca38618d6edceafcc Mon Sep 17 00:00:00 2001 From: Attila Molnar Date: Mon, 24 Mar 2014 16:50:48 +0100 Subject: Add stdalgo::delete_all() that deletes all elements in a container --- include/stdalgo.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'include') diff --git a/include/stdalgo.h b/include/stdalgo.h index 1ae5b8ae1..afbd763fb 100644 --- a/include/stdalgo.h +++ b/include/stdalgo.h @@ -84,4 +84,14 @@ namespace stdalgo { void operator()(classbase* item); }; + + /** + * Deletes all elements in a container using operator delete + * @param cont The container containing the elements to delete + */ + template class Cont, typename T, typename Alloc> + inline void delete_all(const Cont& cont) + { + std::for_each(cont.begin(), cont.end(), defaultdeleter()); + } } -- cgit v1.2.3