[fpc-pascal] A question about generic collections - maybe...

bsquared bwcode4u at gmail.com
Wed Nov 14 21:10:11 CET 2012


Hello,

I am wondering what the best approach to this problem is.

I have what amounts to a Tstringlist that I am attempting to use 
generics for typing the objects and I would like to get the names and 
values as lists.  I am thinking something along the lines of the 
following, but it doesn't feel quite right.

   generic TGenericDatabaseMap<TKey,TData>  = class(TFPGMap)
     function GetDataBases: TFPGList<TData>;
     function GetDatabaseNames: TFPGList<TKey>;
   end;


   TDatabaseMap = specialize TGenericDatabaseMap<String,TDataContainer>;

Any feedback is appreciated

Thank you.

-- 
Regards,
Brian




More information about the fpc-pascal mailing list