Re: [Vala] Array resize



Hi,
  thank you for the reply.
Should I guess that the code I proposed is not valid? Is there anything else that I can do without adding an additional dependency?

Bests,
        Giulio.

Il 27/09/2011 23:16, Гаврилов Максим ha scritto:
Just use one of the Gee's collections that suit you the best.

28.09.2011 0:56 пользователь "Giulio Paci" <giuliopaci interfree it
<mailto: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 <mailto: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]