On Sun, Apr 04, 2010 at 10:09:24AM -0700, Tristin Celestin wrote:
> Is there a means to figure out what kinds of variables a Gee.List stores?
>
> The following doesn't work because if I call mystery_list.get(0), I get
> the compiler error: has no member named ‘g_destroy_func’.
>
> using Gee;
>
> public bool perform (Gee.List mystery_list) {
> if (! mystery_list.is_empty) {
> Value val = mystery_list.get (0);
> if (val.type().is_value_type) {
> // something something
> }
> }
> }
>
> If I cast mystery_list to Gee.List <Object>, my problem is solved (because
> now a destructor is available), but then that means that mystery list
> can only contain items descended from GObject.
You can workaround it by first knowing the subclass using type check, then
getting the property "g-type" which is automatically created by generics in
vala.
E.g.:
Type type;
if (list is LinkedList) list.get("g-type", out type);
You can temporarly look here for "hidden" properties:
http://lethalman.hostei.com/libgee/GeeLinkedList.html#GeeLinkedList.properties
--
http://www.debian.org - The Universal Operating System
signature.asc
Description: Digital signature
_______________________________________________ Vala-list mailing list [email protected] http://mail.gnome.org/mailman/listinfo/vala-list
