Re: [Vala] Sorting an array of instances.



Am Mittwoch, den 28.04.2010, 07:59 +0800 schrieb Nor Jaidi Tuah:
static int cmp_foo(void* a, void* b)
{
    return ((Foo*)a)->val - ((Foo*)b)->val < 0 ? -1 : 1;
}


Use:
 (*((Foo**)a))->val

In
  Foo x;
x is a pointer if Foo is a class, but
an actual structure if Foo is a struct
(unless I misunderstood vala).

Thanks. That worked. :)
I should be thinking more about those pointer thingies.

- fabian

Attachment: smime.p7s
Description: S/MIME cryptographic signature



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