On 1 July 2013 22:48, Nadav Vinik <nadav...@gmail.com> wrote: > > > On 1 July 2013 20:34, Jonas Kulla <nyocu...@gmail.com> wrote: > >> 2013/7/1 Nadav Vinik <nadav...@gmail.com> >> >>> Hello >>> >>> I I use HashMap as a property I get error: >>> c.vala:26.3-26.5: error: missing generic type arguments >>> map[1] = node; >>> ^^^ >>> >>> how should I use gee.HashMap as a property to share it between classes? >>> >>> b.vala compile while c.vala not. >>> >>> thanks for your help >>> Nadav >>> >>> _______________________________________________ >>> vala-list mailing list >>> vala-list@gnome.org >>> https://mail.gnome.org/mailman/listinfo/vala-list >>> >>> >> Hi, >> >> valac said "missing generic type arguments", so I simply added them: >> >> public class Main : Object >> { >> public static HashMap<int, Node?> map; >> >> static int main () >> { >> map = new HashMap<int, Node?>((Gee.HashDataFunc)GLib.direct_hash, >> (Gee.EqualDataFunc)GLib.direct_equal); >> var b = data(); >> var node = new Node(); >> node.c = {'a', 'b'}; >> node.d = &b; >> map[1] = node; >> >> return 0; >> } >> } >> >
How do I get the item from the HashMap? I get: error: Assignment: Cannot convert from `GLib.Node?' to `PcapNode?' PcapNode n = map[1]; thanks Nadav > >> After that I still had to cast the GLib hash and compare functions to >> their Gee counterparts, but now it just compiles. I'm not sure if that >> means it does what you want it to though.. >> > > Thanks! > It's work! > Nadav > > > >> >> Jonas >> > > > > -- > הבלוג שלי: > http://nadavvin.com > -- הבלוג שלי: http://nadavvin.com _______________________________________________ vala-list mailing list vala-list@gnome.org https://mail.gnome.org/mailman/listinfo/vala-list