diff --git a/src/xrt/auxiliary/util/u_hashmap.cpp b/src/xrt/auxiliary/util/u_hashmap.cpp index 325f1cd65..7d65135ca 100644 --- a/src/xrt/auxiliary/util/u_hashmap.cpp +++ b/src/xrt/auxiliary/util/u_hashmap.cpp @@ -73,6 +73,12 @@ u_hashmap_int_erase(struct u_hashmap_int *hmi, uint64_t key) return 0; } +bool +u_hashmap_int_empty(const struct u_hashmap_int *hmi) +{ + return hmi->map.empty(); +} + extern "C" void u_hashmap_int_clear_and_call_for_each(struct u_hashmap_int *hmi, u_hashmap_int_callback cb, diff --git a/src/xrt/auxiliary/util/u_hashmap.h b/src/xrt/auxiliary/util/u_hashmap.h index a123e1b26..f9afcf0b5 100644 --- a/src/xrt/auxiliary/util/u_hashmap.h +++ b/src/xrt/auxiliary/util/u_hashmap.h @@ -41,6 +41,12 @@ u_hashmap_int_insert(struct u_hashmap_int *hmi, uint64_t key, void *value); int u_hashmap_int_erase(struct u_hashmap_int *hmi, uint64_t key); +/*! + * Is the hash map empty? + */ +bool +u_hashmap_int_empty(const struct u_hashmap_int *hmi); + /*! * First clear the hashmap and then call the given callback with each item that * was in the hashmap.