Re: [Vala] Iterator for GLib.List?



You just have to implement the next, iterator and get methods (iirc) i did it for a couple of data structures in radare2 and valaswig.

A .h with defined macros can do the trick

On Jul 31, 2010, at 11:51 AM, Frederik <scumm_fredo gmx net> wrote:

JM wrote:
Hello

GLib.List<T> can be used with foreach(T t in list) in vala. This is
possible even without having an Iterator iterator(). So it looks like
this is not coming from methods with syntax support as mentioned in the
tutorial.
Is there some special code for GLib.List in vala

Yes, it's special code in the Vala compiler.

and if so, is there a
possibility to use it for custom code (like for a node like object that
has children chained to each other like in a double-linked list)?

I guess the goal is not to add more special cases to Vala, that's why
"methods with syntax support" exist. Is there any reason not to use
them in your custom code for these node-like objects?


Best regards,

Frederik
_______________________________________________
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]