On Thu, Aug 18, 2016 at 2:44 PM, Sven Barth <pascaldra...@googlemail.com> wrote:
> generic procedure WriteVector_To_DM<T>(ADest: TDataManager; ASelf:
> specialize TVector<T>);
> generic procedure ReadVector_From_DM<T>(AFrom: TDataManager; var ASelf:
> specialize TVector<T>);
>
> and use them like this:
>
> specialize WriteVector_To_DM<TSubClass1>(...);

Aha, great, didn't know we had something in this direction. But
correct me if I am wrong, but this wouldn't work in my case, because
my function writes the class to a stream in the end of it, so it needs
to know which type T is. If the type is TSomeClass or a descendent,
then it will write each field of the class to the stream.

But in a generic class/function there is no way to ask if T is an int,
or is an TSomeClass, or am I missing some way of writing code that is
different for various possible types?

thanks,
-- 
Felipe Monteiro de Carvalho
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to