about summary refs log tree commit diff stats
path: root/src/include/khash.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/khash.h')
-rw-r--r--src/include/khash.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/include/khash.h b/src/include/khash.h
index 9d20a0e6..823757bf 100644
--- a/src/include/khash.h
+++ b/src/include/khash.h
@@ -556,6 +556,21 @@ static kh_inline khint_t __ac_Wang_hash(khint_t key)
   @abstract     Iterate over the entries in the hash table
   @param  h     Pointer to the hash table [khash_t(name)*]
   @param  kvar  Variable to which key will be assigned
+  @param  vvar  Variable to which value will be assigned
+  @param  code  Block of code to execute
+ */
+#define kh_foreach_ref(h, kvar, rvar, code) { khint_t __i;	\
+	for (__i = kh_begin(h); __i != kh_end(h); ++__i) {		\
+		if (!kh_exist(h,__i)) continue;						\
+		(kvar) = kh_key(h,__i);								\
+		(rvar) = &kh_val(h,__i);							\
+		code;												\
+	} }
+
+/*! @function
+  @abstract     Iterate over the entries in the hash table
+  @param  h     Pointer to the hash table [khash_t(name)*]
+  @param  kvar  Variable to which key will be assigned
   @param  code  Block of code to execute
  */
 #define kh_foreach_key(h, kvar, code) { khint_t __i;           	\