Relative Content

Tag Archive for chashtableglib

How can I get the first key that matches a given value in a GHashTable in C?

I’m writing some C code using GLib and using GHashTable to store some data. However, sometimes I need to do a “reverse lookup” where I need to find the first key that matches a given value. I tried looking through the documentation for GHashTable, but I couldn’t find anything like this. Initially, I was hopeful that g_hash_table_find () could do this, but it only returns the value of the key/value pair, so it can’t do what I’m asking for.