That is actually the best approach if you have holes in your enum (which
may bring in other problems)

On Tue, Aug 30, 2016, 18:11 Evan Nemerson <e...@coeus-group.com> wrote:

> On Mon, 2016-08-29 at 23:47 +0200, rastersoft wrote:
> > Sorry, I found how to do that:
> >
> > int[] blah = new int[LAST_ELEMENT];
>
> If you want to avoid having a LAST_ELEMENT value, something like this
> will also work:
>
>     ((GLib.EnumClass) typeof(Foo).class_ref ()).n_values
>
> I'm not necessarily advocating it, but if you really want to keep your
> API clean it's an option.
>
> >
> > El 29/08/16 a las 23:45, rastersoft escribió:
> > >
> > > Hi all:
> > >
> > > I have an enum with several elements, and I need to create an array
> > > with
> > > the same number of elements. In C I define a last element with a
> > > known
> > > name (eg: "LAST_ELEMENT"), and use "int blah[LAST_ELEMENT];" to
> > > create
> > > the array. How can I do that in Vala?
> > >
> > > Thanks.
> > >
> > _______________________________________________
> vala-list mailing list
> vala-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/vala-list
>
_______________________________________________
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list

Reply via email to