New for_each_map and tests
This commit is contained in:
1 parent
3da4742c5d
commit
5927ab980b
4 files changed
+110
-3
No files matched your search
@@ -41,4 +41,33 @@
|
||||
} \
|
||||
} while (0);
|
||||
|
||||
#define FOR_EACH_MAP(PFX, SNAME, K, V, TARGET, BODY) \
|
||||
do \
|
||||
{ \
|
||||
size_t index; \
|
||||
K key; \
|
||||
V value; \
|
||||
SNAME##_iter iter; \
|
||||
PFX##_iter_new(&iter, TARGET); \
|
||||
while (PFX##_iter_next(&iter, &key, &value, &index)) \
|
||||
{ \
|
||||
BODY; \
|
||||
} \
|
||||
} while (0);
|
||||
|
||||
#define FOR_EACH_MAP_REV(PFX, SNAME, K, V, TARGET, BODY) \
|
||||
do \
|
||||
{ \
|
||||
size_t index; \
|
||||
K key; \
|
||||
V value; \
|
||||
SNAME##_iter iter; \
|
||||
PFX##_iter_new(&iter, TARGET); \
|
||||
PFX##_iter_toend(&iter); \
|
||||
while (PFX##_iter_prev(&iter, &key, &value, &index)) \
|
||||
{ \
|
||||
BODY; \
|
||||
} \
|
||||
} while (0);
|
||||
|
||||
#endif /* CMC_FOR_EACH */
|
||||
+1
-1
@@ -9,7 +9,7 @@
|
||||
*/
|
||||
|
||||
/*****************************************************************************/
|
||||
/**************************************************************** TREESET */
|
||||
/******************************************************************* TREESET */
|
||||
/*****************************************************************************/
|
||||
|
||||
#ifndef CMC_TREESET_H
|
||||
|
||||
Reference in new issue
Block a user