[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: How to use Quarks?
- From: Stefan Kost <ensonic hora-obscura de>
- To: Patrick Braga <theunixgeek lists gmail com>
- Cc: GTK Mailing List <gtk-app-devel-list gnome org>
- Subject: Re: How to use Quarks?
- Date: Sun, 04 Jan 2009 14:41:22 +0200
hi,
Patrick Braga wrote:
> I've just begun learning GLib, and I came across Quarks. The
> documentation describes them as "association between strings and integer
> identifiers. Given either the stringo or the GQuark identifier it is
> possible to retrieve the other."
>
> This seems really useful and all, but I have no idea when this could be
> applied. I don't necessarily want code examples, just something like "if
> you want to do this then you could use quarks to..."
If you use a hashtable with strings as keys, a lookup on the hashtable would
need to compare the strings to find the entry. In some situations you can store
the key-strings in objects and in such a situation you better store the quarks
and use the quarks as keys in the hashtable. Then the lookup only compares integers.
Stefan
>
> Thanks!
>
> Patrick Braga
> http://theunixgeek.blogspot.com
> _______________________________________________
> gtk-app-devel-list mailing list
> gtk-app-devel-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]