Re: GHashTable suggestions



Sven Neumann <sven gimp org> writes:
> 
> this might come a little late, but it's something I just stumpled
> across when looking at the GHashTable API. IMHO it would be very
> convenient if the function
> 
>         gboolean 
>         g_hash_table_remove (GHashTable    *hash_table,
>                              gconstpointer  key);
> 
> would instead return the removed value. 

I think that's a pretty good idea.
 
> Alternatively there could be new functions called for example
> 
>         gboolean g_hash_table_remove_and_destroy (hash, key);
>         gboolean g_hash_table_replace (hash, key, value);
> 
> but this could only work if there was a destroy function that could
> be registered with the GHashTable.
> 

I think some kind of destroy function on the hash table could be
nice. I guess you'd have to think through the details. It might be
nice to be able to memory manage the hash keys also, so two destroy
notifies.

Dunno, would require some thought on the pros and cons. 

Havoc







[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]