vlc | branch: master | Hugo Beauzée-Luyssen <[email protected]> | 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 <[email protected]> > 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 _______________________________________________ vlc-commits mailing list [email protected] http://mailman.videolan.org/listinfo/vlc-commits
