Hello I was wondering if it was possible to store a double into a ghashtable considering there is no gdouble_to_pointer methdod. I am following a tutorial I found online by IBM http://www.ibm.com/developerworks/linux/tutorials/l-glib/section5.html , but I can't seem to find a way to use an int as a key and a double as the value being stored. Any help would be great thanks!
相关问题
- Multiple sockets for clients to connect to
- Do the Java Integer and Double objects have unnece
- What is the best way to do a search in a large fil
- glDrawElements only draws half a quad
- Index of single bit in long integer (in C) [duplic
If you want to use an int as a key, you should use g_int_hash() and g_int_equal() when you create the GHashTable.
As far as using doubles for values goes... you can't. The problem is that you cannot guarantee that sizeof (void *) >= sizeof (double), so you can't use a trick like GINT_TO_POINTER()