Re: [Vala] Array resize



Hi,

Just use one of the Gee's collections that suit you the best.
28.09.2011 0:56 пользователь "Giulio Paci" <giuliopaci interfree it>
написал:
Hi to all,
I need to put in struct a resizable array of structs. Is this possible
in Vala? I tried the following code, but it is not working as expected.
Is this code legal?

struct t{
int d;
}

struct t2{
t[] no;
}

int main(string[] args)
{
t2 fail = t2() {no = new t[1]};
t[] ok = new t[1];
for(int i=0; i<100; i++)
{
stderr.printf("%d %d\n", fail.no.length, ok.length);
fail.no.resize(fail.no.length+1);
ok.resize(ok.length+1);
}
return 0;
}

Bests,
Giulio.
_______________________________________________
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]