c++-gtk-utils
|
A deleter functor for use as the second (Dealloc) template parameter of the SharedHandle, SharedLockHandle or ScopedHandle template classes, which calls glib's g_slice_free1(). More...
#include <c++-gtk-utils/shared_handle.h>
Public Member Functions | |
void | operator() (const void *obj) noexcept |
A deleter functor for use as the second (Dealloc) template parameter of the SharedHandle, SharedLockHandle or ScopedHandle template classes, which calls glib's g_slice_free1().
This functor enables those classes to manage memory allocated with g_slice_alloc(), g_slice_alloc0() or g_slice_copy(). It is an alternative to using GSliceFree where, instead of the template parameter being a pointer to a particular managed type, the size of the memory block to be freed is passed, so enabling it to be more conveniently used to free memory containing arrays of built-in types or of PODSs. Use GSliceDestroy where the memory holds a C++ object constructed in the memory by the global placement new expression.
The type of the template argument for the functor is an integer type (gsize) and is the size of the block to be managed. For example:
The availability of this functor is not dependent on the library having been installed with the --with-glib-memory-slices-compat or --with-glib-memory-slices-no-compat configuration option (see Memory allocation for further details of those options).
|
inlinenoexcept |