From b09efee597f9c9949eed25c2318093e8a4fe0933 Mon Sep 17 00:00:00 2001 From: Andreas Volz Date: Thu, 9 Dec 2010 21:50:56 +0000 Subject: [PATCH] oh, god. I forgot this long time ago to add. This shows me nobody else uses the C++ wrapper for Elementary :-( SVN revision: 55434 --- elementaryxx/src/localUtil.cpp | 6 +++++ elementaryxx/src/localUtil.h | 43 ++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 elementaryxx/src/localUtil.cpp create mode 100644 elementaryxx/src/localUtil.h diff --git a/elementaryxx/src/localUtil.cpp b/elementaryxx/src/localUtil.cpp new file mode 100644 index 0000000..6100b6a --- /dev/null +++ b/elementaryxx/src/localUtil.cpp @@ -0,0 +1,6 @@ +/* Project */ +#include "localUtil.h" + +namespace Elmxx { + +} // end namespace Elmxx \ No newline at end of file diff --git a/elementaryxx/src/localUtil.h b/elementaryxx/src/localUtil.h new file mode 100644 index 0000000..7f8cd13 --- /dev/null +++ b/elementaryxx/src/localUtil.h @@ -0,0 +1,43 @@ +#ifndef ELMXX_LOCAL_UTIL_H +#define ELMXX_LOCAL_UTIL_H + +/* STL */ +#include +#include + +namespace Elmxx { + +// some generic template functions for delete algorithms +template +void delete_one (T *t) +{ + delete t; + t = NULL; +} + +template +void delete_array (T *t) +{ + delete [] t; + t = NULL; +} + +template +struct delete_unary : public std::unary_function +{ + void operator () (T &t) + { + delete t; + } +}; + +template +void delete_stl_container (T &t) +{ + for_each (t.begin (), t.end (), delete_unary ()); + t.clear (); +} + +} // end namespace Elmxx + +#endif // ELMXX_LOCAL_UTIL_H