[vlc-commits] commit: vlc_arrays: Adding a C++ helper to clean a container ( =?UTF-8?Q?Hugo=20Beauz=C3=A9e=2DLuyssen?==?UTF-8?Q?=20?=)

git at videolan.org git at videolan.org
Fri Nov 26 19:50:10 CET 2010


vlc | branch: master | Hugo Beauzée-Luyssen <beauze.h at gmail.com> | Thu Nov 18 13:10:37 2010 +0100| [a1a0cafb6c1184fd2f308af5068b5e4621840e96] | committer: Rémi Duraffort 

vlc_arrays: Adding a C++ helper to clean a container

Signed-off-by: Rémi Duraffort <ivoire at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a1a0cafb6c1184fd2f308af5068b5e4621840e96
---

 include/vlc_arrays.h |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/include/vlc_arrays.h b/include/vlc_arrays.h
index b8dbae4..c61c870 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 <typename T>
+void vlc_delete_all( T &container )
+{
+    typename T::iterator it = container.begin();
+    while ( it != container.end() )
+    {
+        delete *it;
+        ++it;
+    }
+    container.clear();
+}
+
+#endif
+
 #endif



More information about the vlc-commits mailing list