oh, god. I forgot this long time ago to add.
This shows me nobody else uses the C++ wrapper for Elementary :-( SVN revision: 55434
This commit is contained in:
parent
a04f586b15
commit
b09efee597
|
@ -0,0 +1,6 @@
|
||||||
|
/* Project */
|
||||||
|
#include "localUtil.h"
|
||||||
|
|
||||||
|
namespace Elmxx {
|
||||||
|
|
||||||
|
} // end namespace Elmxx
|
|
@ -0,0 +1,43 @@
|
||||||
|
#ifndef ELMXX_LOCAL_UTIL_H
|
||||||
|
#define ELMXX_LOCAL_UTIL_H
|
||||||
|
|
||||||
|
/* STL */
|
||||||
|
#include <algorithm>
|
||||||
|
#include <functional>
|
||||||
|
|
||||||
|
namespace Elmxx {
|
||||||
|
|
||||||
|
// some generic template functions for delete algorithms
|
||||||
|
template <typename T>
|
||||||
|
void delete_one (T *t)
|
||||||
|
{
|
||||||
|
delete t;
|
||||||
|
t = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
void delete_array (T *t)
|
||||||
|
{
|
||||||
|
delete [] t;
|
||||||
|
t = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
struct delete_unary : public std::unary_function <T, void>
|
||||||
|
{
|
||||||
|
void operator () (T &t)
|
||||||
|
{
|
||||||
|
delete t;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename T, typename S>
|
||||||
|
void delete_stl_container (T &t)
|
||||||
|
{
|
||||||
|
for_each (t.begin (), t.end (), delete_unary <S> ());
|
||||||
|
t.clear ();
|
||||||
|
}
|
||||||
|
|
||||||
|
} // end namespace Elmxx
|
||||||
|
|
||||||
|
#endif // ELMXX_LOCAL_UTIL_H
|
Loading…
Reference in New Issue