Hi all,

I am having trouble with the following code:

  generic TVector<T> = class
  type
    DataType = array of T;
  private
    //...
  protected
    //...
  public
    //...
  end;

  generic TSortableVector<T> = class(specialize TVector<T>)
  protected
    function OnSort(v1, v2: T): Integer; virtual; abstract;
    //...
  public
    procedure Sort(Reversed: Boolean = False; OldOrder: PIntegerDynArray =
nil);
    //...
  end;

  TIntegerVector = class(specialize TSortableVector<Integer>)
  protected
    function OnSort(v1, v2: Integer): Integer; override;
  end;

The error I got is:

Error: Forward declaration not solved
"TIntegerVector.TSortableVector$LongInt.OnSort(LongInt,LongInt):LongInt;"

The original code of vector is here:

https://github.com/xrfang/fpcollection/blob/master/src/units/vector.pas

I am having trouble with the original code while specializing TVector with
a Record type that does not have comparison operators.  So I decide to make
OnSort() abstract, and add it whenever needed.

I am running FPC 2.6.4 on Linux x64.

Thanks!

Xiangrong
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to