Extend boxed types to have hash and equal methods
Submitted by Behdad Esfahbod
Link to original bug (#569620)
Description
Boxed types are commonly used to wrap "value" types. Value types are those typically copied by value instead of being refcounted. A very common operation with value types is to hash them. To hash them one needs hash and equal methods. If GBoxed is extended to take hash and equal functions, language bindings get the correct hash and equal functions automatically. Currently the binding writer needs to manually hook up the hash and equal functions.
I'm proposing:
GType g_boxed_type_register_static_full (const gchar *name, GBoxedCopyFunc boxed_copy, GBoxedFreeFunc boxed_free, GHashFunc boxed_hash, GEqualFunc boxed_equal);
guint g_boxed_hash (GType boxed_type, gconstpointer boxed);
gboolean g_boxed_equal (GType boxed_type, gconstpointer boxed_a gconstpointer boxed_b);
If the hash and/or equal functions are not provided, direct hash/equal are used.