From 8c643e9b7df0a269fd3cd7c2c0be22d5c5a13498 Mon Sep 17 00:00:00 2001 From: hiddenalpha.ch Date: Sun, 26 Jul 2026 11:57:12 +0200 Subject: Add `HshIdx.swap()` --- include/qntan/Qntan.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/qntan/Qntan.h b/include/qntan/Qntan.h index d5e77a7..1dcb005 100644 --- a/include/qntan/Qntan.h +++ b/include/qntan/Qntan.h @@ -831,7 +831,7 @@ struct Qntan_HshIdx { size_t (*getCnt)( struct Qntan_HshIdx** ); /* Returns number of objects currently present in this collection. */ - int (*addIfNew)( struct Qntan_HshIdx**, void*elm ); + int (*addIfNew)( struct Qntan_HshIdx**, void*elm, int idx ); /* Returns 0 if 'elm' got copied into the hashtable. * Returns '-EEXIST' (yep, negated) if 'elm' already exists. Nothing got * copied anywhere. @@ -842,6 +842,12 @@ struct Qntan_HshIdx { * Returns 1 if found object got copied to 'ptrToDst'. The element itelf * will swill be present in the table. */ + int (*swap)( struct Qntan_HshIdx**, void*elm, void*ptrToDst, int idx ); + /* Returns 0 if 'elm' got copied into the hashtable. + * Returns 1 is similar to 'Return 0'. BUT: a matching element did already + * exist and this old element now got swapped into 'ptrToDst'. + * Returns negative values to indicate errors. + */ }; -- cgit v1.3.1