Re: [Vala] Gee.HashMap doesn't work



It may be that you need to use direct_hash, direct_equal instead of
int_hash, int_equal.

As I understand it, the latter are for boxed ints.

best,
Dan
___________________________
Daniel Lucraft
http://www.daniellucraft.com/



2008/10/28 Кутейников Дмитрий <kuteynikov gmail com>:
What I'am doing wrong?

using GLib;
using Gee;

public class Test
{
  public string a;
}

public int main(string[] args)

{
  HashMap<uint32, Test> heap = new HashMap<uint32, Test>(int_hash,
int_equal);
  if(heap.get(0) == null) stdout.printf("Null");
  else stdout.printf("Foo");
  Test b = new Test();

  b.a = "hello";
  heap.set(1, b);
  stdout.printf(heap.get(1).a);
  return 0;
}


Stack trace:
#0  0x28123127 in g_int_hash () from /usr/local/lib/libglib-2.0.so.0

#1  0x0804a181 in gee_hash_map_real_get (base=0x28420420, key=0x0)
    at hashmap.c:334
#2  0x0804beca in gee_map_get (self=0x28420420, key=0x0) at map.c:72

#3  0x08049611 in _main (args=0xbfbfecbc, args_length1=1) at
hashtable.vala:12
#4  0x080497ca in main (argc=1, argv=0xbfbfecbc) at hashtable.vala:9

_______________________________________________
Vala-list mailing list
Vala-list gnome org
http://mail.gnome.org/mailman/listinfo/vala-list




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]