Re: [Vala] Sorting an array of instances.
- From: Nor Jaidi Tuah <norjaidi tuah ubd edu bn>
- To: Fabian Deutsch <fabian deutsch gmx de>
- Cc: vala-list gnome org
- Subject: Re: [Vala] Sorting an array of instances.
- Date: Wed, 28 Apr 2010 07:59:16 +0800
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).
hand
Nor Jaidi Tuah
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]