Is it possible to use array of const inside of generics?
Quick example I just typed up. If you specialize the generic the compiler always complains about the type in array of const not being the specialized type. Type casting doesn’t work either because you may have specialized for incompatible types like classes and strings. It would be nice to say: TIntegerCollection.Create([1, 3, 4, 8, 10]) as a way to init the instance. type generic TCollection<T> = class (TObject) constructor Create (args: array of const); procedure Add (a: T); end; TIntegerCollection = specialize TCollection<Integer>; constructor TCollection.Create (args: array of const); begin // ERROR: args[0] is not the type we specialized for. can’t typecast either. if args[0].vtype = vtinteger then Add(T(args[0].vinteger)); end; procedure TCollection.Add (a: T); begin end; Regards, Ryan Joseph _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal