ucx/cx/collection.h

branch
dav-2
changeset 894
e86049631677
parent 891
4d58cbcc9efa
--- a/ucx/cx/collection.h	Tue Dec 30 21:39:38 2025 +0100
+++ b/ucx/cx/collection.h	Wed Dec 31 16:41:16 2025 +0100
@@ -40,10 +40,6 @@
 #include "iterator.h"
 #include "compare.h"
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 /**
  * Special constant used for creating collections that are storing pointers.
  */
@@ -316,8 +312,22 @@
     if ((c)->collection.simple_destructor) cx_invoke_simple_destructor(c,e); \
     if ((c)->collection.advanced_destructor) cx_invoke_advanced_destructor(c,e)
 
-#ifdef __cplusplus
-} // extern "C"
-#endif
+/**
+ * Invokes all available destructor functions for a specific element.
+ *
+ * Usually only used by collection implementations. There should be no need
+ * to invoke this macro manually.
+ *
+ * In contrast to cx_invoke_destructor(), this macro does not automatically
+ * dereference pointers to the elements when cxCollectionStoresPointers()
+ * returns true.
+ *
+ * @param c a pointer to a struct that contains #CX_COLLECTION_BASE
+ * @param e pointer to the element
+ */
+#define cx_invoke_destructor_raw(c, e) \
+    if ((c)->collection.simple_destructor) (c)->collection.simple_destructor(e); \
+    if ((c)->collection.advanced_destructor) (c)->collection.advanced_destructor((c)->collection.destructor_data, e)
+
 
 #endif // UCX_COLLECTION_H

mercurial