Method

GLibHashTableIterinit

since: 2.16

Declaration [src]

void
g_hash_table_iter_init (
  GHashTableIter* iter,
  GHashTable* hash_table
)

Description [src]

Initializes a key/value pair iterator and associates it with hash_table. Modifying the hash table after calling this function invalidates the returned iterator.

The iteration order of a GHashTableIter over the keys/values in a hash table is not defined.

GHashTableIter iter;
gpointer key, value;

g_hash_table_iter_init (&iter, hash_table);
while (g_hash_table_iter_next (&iter, &key, &value))
  {
    // do something with key and value
  }

Available since: 2.16

Parameters

hash_table

Type: GHashTable

A GHashTable.

The data is owned by the caller of the method.