Re: [Vala] Array as generic type not allowed? Can't ArrayList<string[]>



On Fri, Aug 31, 2012 at 12:48 PM, Just Fill Bugs <mozbugbox yahoo com au>wrote:

I tried to create a list of string[] but it's not allowed on vala version
0.16.1.

using Gee;
void main() {
    var strings_list = new ArrayList<string[]>();
}

gives:
error: `string[]' is not a supported generic type argument, use `?' to box
value types

And adding "?" still give the same error.

Should generic support array as a type? Is it a bug?


It's not a bug, it's intentionally not supported as said by the compiler.
You can either create a class to encapsulate your array, or use other data
structures such as GLib.GenericArray or Gee.ArrayList and so on.

-- 
www.debian.org - The Universal Operating System


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]