[fpc-devel] understanding generics

Florian Klaempfl florian at freepascal.org
Fri Nov 13 16:13:31 CET 2009


Paul Ishenin schrieb:
> Hello, FPC developers' list
> 
> I am trying to understand how to add an enumerator support to the fgl
> containers. Seems it is imposible.
> 
> I need enumerator to return the same type as generic container. So I
> declared enumerator class as generic too. But how to use it inside the
> generic container class?
> 
> I guessed to use the next construction:
> 
> generic  TFPGList<T>   =  class(TFPSList)
> type  public
>   TFPGListEnumeratorSpec   =  specialize  TFPGListEnumerator<T>;
> ....
> 
> Everything compiles fine, but when I declare a specialize type for the
> generic  TFPGList I get very strange compiler errors.
> 
> I attached a simple project which exposes the bug.
> 

Probably something wrong with nested token replay.



More information about the fpc-devel mailing list