[Vala] can a struct be stored in a map?



My first take is that the answer is no, and I'm enough of a neophyte that

words.vala:53.29-53.33: error: `Entry' is not a supported generic type argument, use `?' to box value types

doesn't convey much to me.  (Entry refers to:

struct    Entry
{   public    long    id;
    public    string    name;
    public    string    data;
    public    int    count;
    public    bool    dirty;
}

and the error message was generated by:

    HashMap<int32, Entry>     ids;

currently I'm avoiding the problem by converting the struct to a class, and at least in this case that's a reasonable approach, (or, of course, I could probably store a pointer to the struct, but in my eyes one of the advantages of Vala is that it minimizes the number of times I need to explicitly deal with pointers).

--
Charles Hixson




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