summaryrefslogtreecommitdiff
path: root/glib/glibmm/utility.h
diff options
context:
space:
mode:
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 */