From a1a0cafb6c1184fd2f308af5068b5e4621840e96 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Hugo=20Beauz=C3=A9e-Luyssen?= Date: Thu, 18 Nov 2010 13:10:37 +0100 Subject: [PATCH] vlc_arrays: Adding a C++ helper to clean a container MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Rémi Duraffort --- include/vlc_arrays.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/include/vlc_arrays.h b/include/vlc_arrays.h index b8dbae473c..c61c870b94 100644 --- a/include/vlc_arrays.h +++ b/include/vlc_arrays.h @@ -617,4 +617,20 @@ vlc_dictionary_remove_value_for_key( const vlc_dictionary_t * p_dict, const char /* No key was found */ } +#ifdef __cplusplus +// C++ helpers +template +void vlc_delete_all( T &container ) +{ + typename T::iterator it = container.begin(); + while ( it != container.end() ) + { + delete *it; + ++it; + } + container.clear(); +} + +#endif + #endif -- 2.39.2