On 03/03/2011 05:56 AM, Peter Lundgren wrote:
Where can I go to learn about parameterized structs? I can't seem to find any
literature on the subject. In particular, what are you allowed to use as a
parameter? I would like to define a struct like so:

struct MyStruct(T, T[] a) {
     ...
}

but I receive the following error:

Error: arithmetic/string type expected for value-parameter, not T[]

Are arrays not allowed?

Aside the error, I find this a bit strange. Do you really mean that /both/ a type T and an element of type T[] are /template/ parameters? Would you show your case? I expect (but may be wrong, indeed) something like this:
struct MyStruct(T) {
    T[] a;
    ...
}
or maybe:
struct MyStruct(T) {
    static T[] a = [...];
    ...
}

Denis
--
_________________
vita es estrany
spir.wikidot.com

Reply via email to