Hi,

I try to do exactly the same as show here:


QUOTE:
http://svn.freepascal.org/svn/fpc/trunk/packages/fcl-stl/src/gvector.pp

generic TVector<T> = class
  ... ...
  type
    TVectorEnumerator = class
    private
      FVector: TVector;
      FPosition: SizeUInt;
      FFirstDone: Boolean;
      function GetCurrent: T; inline;
    public
      *constructor Create(AVector: TVector);*
      function MoveNext: Boolean; inline;
      property Current: T read GetCurrent;
    end;
  ... ...
  public

My code:

generic TTreap<TKey, TValue> = class
  ... ...
  type
    TTreapEnumerator = class
      FStack: TStack;
      FCurrent: PNode;
    public
      *constructor Create(ATreap: TTreap);*

      destructor Destroy; override;
      function MoveNext: Boolean;
      property Current: PNode read FCurrent;
    end;
  ... ...
  private

Error message I got is: Error: Generics without specialization cannot
be used as a type for a variable

Then I found this: http://bugs.freepascal.org/view.php?id=19499&history=1

I wonder if this bug's fix is release or not? How does the TVector
class compile with this problem?

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

Reply via email to