summaryrefslogtreecommitdiff
path: root/glib/glibmm/utility.h
diff options
context:
space:
mode:
authorMarcin Kolny <marcin.kolny@gmail.com>2015-08-08 14:45:12 +0200
committerMarcin Kolny <marcin.kolny@gmail.com>2015-08-08 14:45:59 +0200
commit0d5f63b18f5766760cf39e82ee11482984e0a938 (patch)
treee3f74b9b37e7618c92840024077dff43e6d08f0d /glib/glibmm/utility.h
parentdce7a844e48a582e42eb2b60eef5c1f2527540ac (diff)
parentd94115843f38967b5e883f5f7d8057882ae364cb (diff)
downloadglibmm-gir-gmmproc.tar.gz
Merge branch 'master' into glibmm-gir-gmmprocglibmm-gir-gmmproc
Diffstat (limited to 'glib/glibmm/utility.h')
-rw-r--r--glib/glibmm/utility.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/glib/glibmm/utility.h b/glib/glibmm/utility.h
index 6e5319b8..79fecb6b 100644
--- a/glib/glibmm/utility.h
+++ b/glib/glibmm/utility.h
@@ -1,4 +1,3 @@
-// -*- c++ -*-
#ifndef _GLIBMM_UTILITY_H
#define _GLIBMM_UTILITY_H
@@ -113,6 +112,16 @@ std::string convert_return_gchar_ptr_to_stdstring(char* str)
// Append type_name to dest, while replacing special characters with '+'.
void append_canonical_typename(std::string& dest, const char* type_name);
+// Delete data referred to by a void*.
+// Instantiations can be used as destroy callbacks in glib functions
+// that take a GDestroyNotify parameter, such as g_object_set_qdata_full()
+// and g_option_group_set_translate_func().
+template <typename T>
+void destroy_notify_delete(void* data)
+{
+ delete static_cast<T*>(data);
+}
+
} // namespace Glib
#endif /* DOXYGEN_SHOULD_SKIP_THIS */