[fpc-devel] Specialized Generic for Structures with Abstract Methods

Andrew Brunner andrew.t.brunner at gmail.com
Tue Jun 22 18:15:28 CEST 2010


In uGenerics I have two lists. 1 for Data Structures and 1 for Objects.


If I place this statement in declarations for a system that handles an
Int64 List...

     GInt64List=specialize GStructList<Int64>;

... then I get

C:\Developer\Source\Libraries\Core\uInt64Array.pas(54,17) Error:
Forward declaration not solved "GStructList$Int64.Empty(var Int64);"

For the most part I want to have a generic case for data structures
with the list object handling init, copy,empty,and done methods for
the elements.

I am using FPC from today's trunk and wanted to know if there is
something wrong with generics that I can't use abstract methods for my
generic and just populate the methods "AFTER" I specialize...

  GInt64List=specialize GStructList<Int64>;

  TInt64List=Class(GInt64List)
  public
    procedure Empty(Var Item:Int64); override;
    procedure Done(Var Item:Int64);override;
    procedure Init(Var Item:Int64);override;
  end;

I'm getting compiler errors b/c abstractions ... The way I've used
generics in FPC is that I preface my generic types with "G"... Then I
descend from that class the actual class I want to use.

Can the current FPC be worked to make this happen or do I need to
submit a report?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: uGenerics.pas
Type: application/octet-stream
Size: 3355 bytes
Desc: not available
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20100622/af4b4dce/attachment.obj>


More information about the fpc-devel mailing list